Repository navigation
feat(tts): OpenAI engine talks to any OpenAI-compatible server - #58
Merged
Merged
Conversation
engines.openai() gains `baseUrl` and `timeoutMs`, so self-hosted TTS servers that implement /v1/audio/speech work without a custom engine. With `baseUrl` set, OPENAI_API_KEY is never read, so an OpenAI key is not sent to another server; an explicit `apiKey` is passed through, otherwise a placeholder, since the SDK refuses an empty key. `baseUrl` is recorded in the engine metadata. With openai >= 5, Node's built-in fetch still ends a request after ~300 s without response headers, whatever `timeoutMs` says; documented, not worked around. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UV59h7xwn1rScigEo4KA88
shreyaskarnik
added a commit
that referenced
this pull request
Oct 27, 2026
Document engines.openai() baseUrl/timeoutMs (#58) in the argo-guide skill. Claude-Session: https://claude.ai/code/session_01A5noi8MogUjD2mdirpzXmY
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
engines.openai()gains two options so it can narrate through any server that implements OpenAI'sPOST /v1/audio/speech(self-hosted TTS such as Kokoro-FastAPI or a CosyVoice server), without a custom engine:baseUrl: the server's base URL, including/v1. Named likeengines.mlxAudio()'s option.timeoutMs: the SDK request timeout, since local servers on CPU can take minutes per clip.Key safety
With
baseUrlset, the engine never readsOPENAI_API_KEY, so an OpenAI key in the environment is not sent to another server. An explicitapiKeyis passed through; otherwise the placeholderunusedis sent, because the SDK refuses an empty key. WithoutbaseUrl, behaviour is unchanged (a key is still required for OpenAI).baseUrlis added todescribe(), so the video's metadata names the server. It is not part of the clip cache key, as with the other engine options.Known limit: ~300 s with openai >= 5
timeoutMsalone does not let a request wait longer than about 5 minutes onopenai5+: those versions use Node's built-infetch, whoseheadersTimeout(300 s) applies first. Measured against a stub server that answers after 320 s: v4.104 ok, v6.49 fails at 304 s. This PR documents it (README and the option's doc comment) rather than working around it; #59 describes the options for a fix.Tests
tests/tts/openai.test.ts(new, 7 tests, SDK mocked at the constructor): default key from the environment; key still required for OpenAI;baseUrl+timeoutMsreach the client;OPENAI_API_KEYnever sent to another server; explicitapiKeypassed through; voice and PCM request; metadata.tsc --noEmitclean.The full suite has 11 failures on this machine (Windows) in export, pipeline, repo-hygiene, e2e record, hf block-filter and shader-render; they fail identically on a clean
main(c563ef2), so they are unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01UV59h7xwn1rScigEo4KA88