Fix: live recording + whisper.cpp + Translate task → "File Not Found (/audio/translations)"#1555
Merged
raivisdejus merged 1 commit intoJul 17, 2026
Conversation
Live recording with the whisper.cpp backend and task=Translate failed with "File Not Found (/audio/translations)". The local whisper-server process is only ever started with a single route, --inference-path /audio/transcriptions, but _transcribe_via_api() called the OpenAI client's .audio.translations.create(), which POSTs to /audio/translations — a path the local server never exposes. Fix: - start_local_whisper_server() now passes --translate to the whisper-server subprocess when the selected task is Translate, so its single endpoint returns translated (English) text instead of a same-language transcript. - _transcribe_via_api() now always calls .audio.transcriptions.create() when talking to the local whisper.cpp server, since that's the only route it exposes, regardless of task. Behavior for the OpenAI Whisper API backend (which does expose both /audio/transcriptions and /audio/translations) is unchanged. File-based transcription (whisper_cpp.py, using whisper-cli directly) was already unaffected by this bug and remains unchanged.
raivisdejus
enabled auto-merge (squash)
July 17, 2026 06:02
Collaborator
|
@NumerousDragonfly Thanks for your contribution! Nice fix |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1555 +/- ##
==========================================
- Coverage 82.98% 82.95% -0.03%
==========================================
Files 108 108
Lines 11693 11697 +4
==========================================
Hits 9703 9703
- Misses 1990 1994 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fix: live recording + whisper.cpp + Translate task → "File Not Found (/audio/translations)"
Bug
Using live recording with the whisper.cpp backend, source language
zh,task
Translate, fails immediately with:Transcription (task=Transcribe) works fine on the same setup; only
Translate is broken.
Root cause
start_local_whisper_server()boots the bundledwhisper-serverwith asingle hardcoded route:
Meanwhile,
_transcribe_via_api()picks between the OpenAI SDK's.audio.transcriptions.create()and.audio.translations.create()based on task. When task is Translate, the SDK POSTs to
/audio/translations— a route the local server never registers — sothe request 404s.
This affects every user running live recording + whisper.cpp + Translate,
not just a specific machine/config. File-based transcription (
whisper_cpp.py,which invokes
whisper-clidirectly with a--translateflag) is unaffected.Fix
whisper.cpp's
whisper-serversupports its own--translateflag, whichmakes its single endpoint return translated text instead of a same-language
transcript. Two small changes:
start_local_whisper_server()passes--translateto the serversubprocess when the selected task is Translate.
_transcribe_via_api()always calls.audio.transcriptions.create()when the backend is the local whisper.cpp server, since that's the
only route it exposes — regardless of task.
The OpenAI Whisper API backend (
ModelType.OPEN_AI_WHISPER_API), whichgenuinely exposes both
/audio/transcriptionsand/audio/translationson the real OpenAI API, is unaffected — the transcribe/translate branch
there is preserved exactly as before.
Testing
Notes for reviewers
No new endpoints, no changes to file-based transcription, no changes to
faster-whisper/Hugging Face code paths. Scope is limited to the
live-recording + local-whisper.cpp-server code path.