Repository navigation
Move OpenAI text-to-speech to the Realtime API before tts-1 shuts down - #248
Merged
Merged
Conversation
OpenAI shuts down tts-1, tts-1-hd and gpt-4o-mini-tts on 6 January 2027. The named replacement, gpt-realtime-2.1-mini, does not work on /v1/audio/speech and only runs through the Realtime API. - Add lib/voice/openai-realtime-tts.ts: mints an ephemeral key with the user's key, opens the Realtime WebSocket with it, sends the text, and wraps the returned PCM16 24 kHz audio in a WAV blob. - Use it in voice-clone.ts (tts-1-hd), tts-preview.tsx and voice-translator.tsx (tts-1). The local XTTS clone path is unchanged. - Replace the tts-1-only voices (fable, nova, onyx) with Realtime voices in the pickers; saved settings that still hold them are mapped to verse, coral and ash. - Clamp speed to the Realtime range (0.25-1.5); duration matching with OpenAI voices now tops out at 1.5x. - Allow wss://api.openai.com in the Tauri and production CSP. Reported in a GitHub issue. Not yet tested against the live API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
OpenAI shuts down
tts-1,tts-1-hdandgpt-4o-mini-ttson 6 January 2027 (deprecations, TTS guide). The named replacement,gpt-realtime-2.1-mini, is not supported on/v1/audio/speech. It only runs through the Realtime API.Refs #247. That issue only pointed at
tts-1-hdinvoice-clone.ts.tts-1was also used intts-preview.tsxandvoice-translator.tsx.What changed
lib/voice/openai-realtime-tts.ts. It works in three steps:POST /v1/realtime/client_secretswith the user's key and gets back an ephemeral key, with the session already configured.wss://api.openai.com/v1/realtimeusing only the ephemeral key, passed in the subprotocol.session.createdit sends the text and collectsresponse.output_audio.deltauntilresponse.done. The PCM16 24 kHz audio comes back wrapped in a WAV blob.fable,novaandonyxonly exist fortts-1/tts-1-hd. The pickers now offer Realtime voices instead, including the recommendedmarinandcedar. Settings saved with the old voices are mapped toverse,coralandashinstead of failing. The threettsPreviewCompi18n keys were renamed in all 12 locales.tts-1allowed up to 4). Duration matching with OpenAI voices now tops out at 1.5x.wss://api.openai.comto the Tauri CSP and to the production CSP inmiddleware.ts. Without it the WebView cannot open the socket.What reviewers should know
SynthesisRequest.outputFormatno longer applies.wss://api.openai.comonly.Checks
npm run typecheck: cleannpm run i18n:check: no new hardcoded strings (770 = baseline)npx vitest run: 1255 passed, 37 skipped. New tests are in__tests__/lib/voice/openai-realtime-tts.test.ts; the two voice tests that checked/v1/audio/speechwere updated.🤖 Generated with Claude Code