Let VocaLinux hit this host as an OpenAI transcription server - #37
Merged
Conversation
Closes #36. Desktop embed stays Planned. This adds POST /v1/audio/transcriptions, using the same bearer token as the rest of the API and the same adhoc transcribe path as the WebUI test recorder. The response is {"text"}. The model form field is ignored; whatever engine you loaded in the WebUI is what runs. Pairing is unchanged. This path does not speak /inference and does not stream. Known limits: VocaLinux still defaults to /inference, so the dropdown has to be switched. Test Connection is GET / and does not prove the token.
✅ Deploy Preview for voca-gateway canceled.
|
jatinkrmalik
marked this pull request as ready for review
August 30, 2026 20:17
|
| Filename | Overview |
|---|---|
| app/routes/transcriptions.py | Adds the authenticated OpenAI-compatible route with early request-size enforcement, bounded copying, validation, transcription, and cancellation-safe cleanup. |
| app/main.py | Registers the new transcription router without changing the existing session or streaming routes. |
| app/schemas.py | Adds the minimal OpenAI-compatible transcription response schema. |
| tests/test_transcriptions.py | Covers authentication, successful transcription, validation failures, upload limits, and early Content-Length handling. |
| README.md | Documents configuring VocaLinux to use the new OpenAI-compatible endpoint. |
| docs/configuration.md | Adds operational details and limitations for VocaLinux remote API use. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[VocaLinux POST multipart audio] --> B[Authenticate bearer token]
B --> C[Validate Content-Length before multipart parsing]
C --> D[Parse and validate form fields]
D --> E[Copy audio with file-size limit]
E --> F[Finalize temporary upload]
F --> G[transcribe_adhoc using loaded WebUI engine]
G --> H[Delete finalized audio]
H --> I[Return JSON text]
Reviews (3): Last reviewed commit: "Require Content-Length on the OpenAI tra..." | Re-trigger Greptile
Content-Length is checked after the bearer token and before the multipart parser, with 64KiB of slack for wrapping. The copy loop still 413s if that header is missing. A disconnect during the write now deletes the hidden .upload file.
A missing or junk header used to fall through, so FastAPI still parsed the multipart body and an authenticated client could fill /tmp. Missing Content-Length is now 411, invalid values are 400, and a declared length over the cap is still 413, all in the early route handler before request.form(). The copy loop cap stays.
Member
Author
|
Shipping this. A running VocaLinux can point remote_api at POST /v1/audio/transcriptions on a self-hosted gateway. Desktop embed stays Planned. |
12 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.
Closes #36.
Desktop embed stays Planned. Phone pairing and the session API are untouched.
POST /v1/audio/transcriptions accepts the OpenAI multipart shape (file plus optional model, language, response_format, and stream). Auth is the same bearer token. Transcription goes through transcribe_adhoc, the same path the WebUI test recorder uses. The JSON body is {"text"}. The model field is ignored, so whisper-1 and sensevoice both hit whatever engine is loaded in the WebUI. language falls back to auto. verbose_json and stream=true return 400.
There is no /inference route.
Known limits: VocaLinux still defaults to /inference, so the dropdown has to be switched. Test Connection is GET / and does not prove the token.