feat(transcription): allow an OpenAI-compatible endpoint for the openai provider - #342
Open
HearthCore wants to merge 2 commits into
Open
HearthCore wants to merge 2 commits into
HearthCore wants to merge 2 commits into
Conversation
…ai provider The openai transcription provider hardcoded api.openai.com, whisper-1 and OPENAI_API_KEY, so self-hosters could not route voice clips through LiteLLM, Groq or a self-hosted OpenAI-compatible gateway, while chat routes already accept a custom base URL. TRANSCRIPTION_OPENAI_BASE_URL, TRANSCRIPTION_OPENAI_MODEL and TRANSCRIPTION_OPENAI_API_KEY override the endpoint, model and key. Unset, behaviour is unchanged. A keyless custom endpoint is called without an Authorization header; api.openai.com still requires a key.
Author
|
Ran the full Side note, unrelated to this PR: outside UTC, |
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.
Summary
The
openaitranscription provider hardcodeshttps://api.openai.com/v1,whisper-1andOPENAI_API_KEY. Chat routes already accept a custom OpenAI-compatible base URL, but voice clips cannot go through LiteLLM, Groq or a self-hosted gateway. And thelocalprovider sends neither key nor model, so it only fits keyless Whisper services. Three optional env vars close that gap:TRANSCRIPTION_OPENAI_BASE_URL: base URL including/v1(defaulthttps://api.openai.com/v1)TRANSCRIPTION_OPENAI_MODEL: defaultwhisper-1TRANSCRIPTION_OPENAI_API_KEY: falls back toOPENAI_API_KEYWhen unset, behaviour is unchanged. A keyless custom endpoint is called without an
Authorizationheader, andapi.openai.comstill refuses to run without a key.TranscriptionResult.modelnow reports the model that was actually used. The self-hosting env table gains the transcription variables, which were missing entirely.Type
Test plan
apps/api/test/transcription-openai-compatible.test.ts(fetch mock, no DB): default path unchanged, custom URL/model/key, keyless endpoint, missing key on api.openai.com. 4/4 pass. Onmaster, the two new-behaviour cases fail as expected.pnpm --filter @deft/api typecheckpasses.git diff --checkis clean.TRANSCRIPTION_PROVIDER=local+WHISPER_URL, which only works because that gateway needs no key and ignoresmodel.pnpm --filter @deft/api test(needs a disposable Postgres) andpnpm build.Checklist
pnpm -r typecheckfor@deft/apiapps/api/test/pass.envcontent committedRelated issues
None found (searched open and closed issues and PRs).