Skip to content

Studio: transcribe audio through a saved connection on the Audio page - #14289

Merged
danielhanchen merged 8 commits into
unslothai:mainfrom
NilayYadav:audio-transcribe-connections
Oct 22, 2026
Merged

danielhanchen merged 8 commits into
unslothai:mainfrom
NilayYadav:audio-transcribe-connections

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Settings > Voice can send dictation to a saved speech-to-text connection, but the Audio page's Transcription tool only offered on-device models.

The Transcribe picker now has a Connected section. It lists Whisper, ASR and transcription models from saved connections, OpenAI's whisper-1, gpt-4o-transcribe and gpt-4o-mini-transcribe, and the model set for dictation. Picking one sends the audio to the connection from the server with its saved key, and the transcript streams in and lands in History like a local one. Timestamps asks for line and word times, and is off for the gpt-4o models, which return text only. Speakers stays off, and nothing loads on the device.

Audio over 25 MB, OpenAI's limit, is refused with a clear message before anything is sent.

Part of #14194
Fixes #14194

Before / after

Studio built at current main, which already has the Speak connection from #14288 (left), and at this branch's head (right), with a saved custom connection named Scene Speech Box pointing at a local OpenAI-compatible server that lists kokoro and whisper-large-v3.

Transcribe picker: the Connected tab now appears and lists only the speech-to-text model, not the TTS one.

Transcribe picker before and after

Transcribing an uploaded clip through the connection: one request goes to /v1/audio/transcriptions, the transcript shows and lands in History, Speakers is off with its reason, and Use via API is hidden while the connection is picked.

Transcribe through a connection before and after

@NilayYadav NilayYadav self-assigned this Oct 19, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T14:36:54.083714Z 48ee3ba Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a440e7bb74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

language = body.language,
response_format = "verbose_json" if body.timestamps else "json",
timestamp_granularities = ["segment", "word"] if body.timestamps else None,
encrypted_api_key = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Forward retained legacy keys for connection transcripts

When credential migration fails for an upgraded browser, reconcileLegacyProviderKeys deliberately retains the browser key and the existing dictation adapter encrypts it per request (studio/frontend/src/features/chat/adapters/studio-model-dictation-adapter.ts:172-179). This new call hard-codes encrypted_api_key to None (and the new request model has no key field), so the Audio-page connection fails authentication even though the same saved connection still works for dictation; forward the retained encrypted key through this route.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this: a browser-only key exists only until the next provider sync moves it to the server (the migrate route fails only on 404 or an empty key), so this path does not reach a real session.

Comment on lines +27400 to +27402
stream_transcript(
lambda _on_progress: _external_source_transcript(body, source, request),
body.title or source.name,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Track Audio-page connection calls in the API monitor

When transcription on the Audio page uses a saved connection, this streaming lambda calls the provider without _monitored_media_request; the existing proxied STT route explicitly opens a row and records the reply at studio/backend/routes/inference.py:26028-26051. Consequently this new external request, its error, and its transcript are absent from the API monitor even though other saved-connection media traffic is tracked; wrap the deferred provider run in the monitor and set its reply.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this here: monitor coverage for the Audio page is a separate parity change; the transcript itself is streamed and saved correctly.

@danielhanchen

Copy link
Copy Markdown
Member

Frontend unit tests (Windows) fails on this PR, not on main:

not ok 1040 - Transcribe's settings come back after a reload and are written back under the versioned key
  location: studio/frontend/tests/audio-transcribe-store.test.ts:28
  Expected values to be strictly deep-equal:
  +   connectionModel: null,

The PR adds connectionModel to what audio-transcribe-store.ts persists, and that test compares the persisted object with deepStrictEqual, so it needs the new field in its expected value. Worth deciding whether a saved connection's model should survive a reload at all: if it should, add connectionModel to the expectation and a round-trip case with a non-null value; if not, leave it out of partialize and the test passes as is.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: f4e2dc5e9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

Review + reproduction evidence

Pinned review: f4e2dc5e9be5219701361d39c2182c248352bd9d. One fix pushed in f4e2dc5: the transcribe store test still expected the old state shape, which turned the two frontend CI jobs red. The automated review found no major issues on f4e2dc5, and CI is green.

I ran Audio > Transcribe against a self-hosted speaches server (faster-whisper-tiny), saved as a Custom connection, on the merge base 28a222f and on the PR (Linux, Chromium, 1440x900). The PR shots are from a440e7b; f4e2dc5 only changes a test file.

  • Before: the picker has no Connected section and Transcribe stays disabled ("Pick a speech-to-text model to transcribe").
  • PR: Connected > Speaches box > faster-whisper-tiny shows "Transcribes through Speaches box." The 5.5 s clip came back as "The quick brown fox jumps over the lazy dog. Unsloth Studio transcribes this sentence." in 2.4 s and landed in History. With Timestamps on, Segments shows lines at 0:00 and 0:03.

PR 14289 before/after: Connected section and transcript via the connection

Conclusion: works end to end and is ready to merge. Land it before #14288, which then needs main merged in (audio-page.tsx, 3 hunks).

@danielhanchen danielhanchen self-assigned this Oct 20, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1726700c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1923 to +1925
mode === "transcribe" && transcribeConnection
? transcribeConnection.id
: (connection && speakConnection.modelId) || selectorValue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Hide the local eject state for connection picks

When a local STT model is already resident and the user switches to this Connected value, the loaded prop remains tied to sttReady and the onEject guard below remains enabled from selectorValue. The check/eject affordance is therefore attached to the connected model; clicking it unloads the old on-device model without clearing the connection, while a connection chosen with no resident local model is shown as unloaded. Treat the connection as independently ready and suppress the local eject affordance while it is selected.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this: the eject only unloads the resident on-device model, which the connection run does not use, so nothing is lost or misrouted; it is cosmetic.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48ee3ba5d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dictationModel?: string,
): string[] {
const ids = [
...(isOpenAIApi(connection) ? OPENAI_TRANSCRIBE_MODELS : []),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Seed Mistral transcription models outside the chat catalog

When a user creates an ordinary Mistral connection and loads its catalog, models and availableModels contain only IDs admitted by the chat-oriented allowlist in studio/backend/core/inference/providers.py:249-254, which excludes voxtral-mini-latest; unlike OpenAI, Mistral gets no hard-coded transcription IDs here, and its connection form does not accept manual IDs. Consequently this returns no Connected Transcribe entries unless the user first configures the unrelated dictation setting manually, so the Audio page cannot discover Mistral's supported transcription model; seed Voxtral for Mistral or retain STT IDs in a separate catalog.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this for a follow-up: seeding Mistral's transcription models is new provider support, not a defect here. A Mistral connection lists no Connected Transcribe rows today, the same as before this PR, and nothing it lists is misrouted.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48ee3ba5d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"on-device model."
),
)
response = await _external_stt_transcription(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Append STT paths before base URL queries

In the new /audio/transcribe/source connection branch, a saved connection with a query-bearing base URL (an explicitly supported shape in validate_provider_base_url, e.g. https://gateway/v1?key=...) reaches ExternalProviderClient.create_transcription, which still builds f"{self.base_url}/audio/transcriptions" at studio/backend/core/inference/external_provider.py:7597. The suffix therefore becomes part of the query instead of the path, so every Audio-page transcription for that connection targets /v1 and fails; use _append_provider_path as speech and image requests do.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, not from this PR: main builds the same URL in create_transcription and the existing dictation route already reaches it. It needs its own fix covering both callers.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 22, 2026
@danielhanchen
danielhanchen merged commit 2cfa64f into unslothai:main Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Allow using external connections from the Audio tools

2 participants