Migrating from /v1/speak to Flux TTS
Migrating from /v1/speak to Flux TTS
A step-by-step path from the /v1/speak WebSocket to the streaming-first /v2/speak Flux TTS surface, with a side-by-side of what changes.
Flux TTS ships on a new endpoint, /v2/speak. The /v1/speak endpoint stays available and unchanged, and all Aura model strings continue to work on it — there is no aliasing, redirect, or deprecation. You migrate when you’re ready to build on the streaming-first surface.
Which should you use?
Use Flux TTS for new voice-agent work: streaming LLM output, barge-in, and multi-turn conversations where tone should carry across turns.
Stay on Aura if you’re using Aura voices. Aura voices are served only on /v1/speak; Flux voices only on /v2/speak (where a flux-* model is required).
What changes
Migration steps
- Change the endpoint. Point your WebSocket at
/v2/speak(was/v1/speak). The Python (deepgram-sdk) and JavaScript (@deepgram/sdk) SDKs expose aspeak.v2client — see Getting Started and the template apps — or integrate against the WebSocket directly. - Keep your
Speakmessages. TheSpeakshape is unchanged. Do not specifyspeech_id— the server assigns it and returns it for debuggability. - Require a
model.modelis required on every/v2/speakconnection. Use a Flux TTS voice string (e.g.flux-haley-en); Aura voices are served by/v1/speak, not/v2/speak. - Replace
ClearwithInterrupt. End each turn withFlush; on barge-in, sendInterruptand use the returnedtext_spoken/text_remainingto reconcile your LLM context — see Interruption Handling. - Treat
Flushas end-of-turn, and readSpeechMetadata.Flushmarks the end of a turn (there’s no separateFinalize). The turn’sSpeechMetadatareports billing and timing — use it as your end-of-turn signal (notFlushed), and drop any client-side character-count or audio-duration tracking. - Drop the flush toggles. The v1
flush_send-style toggles don’t exist on v2 — audio starts streaming for a turn on its own, and youFlushonly to mark the end of the turn. - Drop reconnect-to-reset logic. Prosody carries across turns automatically; there’s no reset step to port.
- Insert whitespace between distinct LLM responses. The server doesn’t add whitespace between
Speakmessages — see Text handling.
Message mapping
The /v2/speak column mixes messages you send (Speak, Flush, Close) with messages the server sends back (Connected, Flushed, SpeechMetadata, SessionMetadata). See Client Messages and Server Messages for the full split.
Behaviors carried forward
- The
Speakmessage shape is unchanged from v1. - 1-hour max session duration carries over from v1. New on v2: a 60s inactivity timeout (
NET-0004) — send a WebSocket Ping (or Pong) to keep long-idle sessions alive.
Markup handling carries its own warning codes, and inline pause and pronunciation controls are coming soon — see Markup handling and the warning codes.
Related resources
- Getting Started with Flux TTS — connect and send your first turn
- Client Messages / Server Messages — full wire reference
- The Speech Lifecycle — the turn model that replaces v1’s buffer model
- Aura (/v1/speak) docs — the endpoint you’re migrating from