Server Messages

The messages Flux TTS sends back on /v2/speak — Connected, lifecycle and metadata events, interruption and configuration responses, warnings, errors, and the code reference.

The server replies to your Client Messages with JSON text frames interleaved with binary audio frames. This page documents every server-to-client message and the error/warning code reference.

Cadence at a glance: SpeechStarted marks the start of a turn and SpeechMetadata marks its end — every audio frame for a turn arrives between the two. Flush is your signal that all of the turn’s text has been sent; once it arrives, SpeechMetadata is our signal that all of the turn’s audio has been sent.

Connected

Sent immediately on a successful connection. Successor to v1/speak’s Metadata message.

1{
2 "type": "Connected",
3 "request_id": "550e8400-e29b-41d4-a716-446655440000",
4 "model_name": "flux-haley-en",
5 "model_version": "2026.06.01",
6 "model_uuids": ["b3e47c20-9f81-4a2e-bd15-8d7c6e2a1f09"]
7}
FieldTypeDescription
request_idstring (UUID)ID of the /v2/speak request.
model_namestringResolved model name (e.g. flux-haley-en).
model_versionstringResolved model version.
model_uuidsarray of string (UUID)Resolved model UUIDs. A list, because a resolved model may be backed by more than one underlying model.

SpeechStarted

Emitted at the start of each new turn, before audio streaming begins. Carries the server-assigned speech_id. Fires once per turn.

1{
2 "type": "SpeechStarted",
3 "speech_id": "dg_sp_a1b2c3d4e5f6"
4}

The speech_id is a server-minted identifier of the form dg_sp_<12 hex digits>. It is informational — useful for correlating logs.

When a turn becomes active. A Speak received while idle (the first Speak, or the first after a SpeechMetadata) starts a new active turn, and we emit SpeechStarted. There is only ever one active turn: a Speak received after you’ve Flushed the active turn but before its SpeechMetadata starts a pending turn. The active turn stays active until its SpeechMetadata — if you haven’t received SpeechMetadata, the turn is still being synthesized — at which point the next pending turn becomes active and gets its own SpeechStarted.

SpeechMetadata

Emitted once per turn, after we’ve sent all of the turn’s audio — our signal that synthesis for the turn is complete and no more audio is coming for it. It follows your Flush, which tells us no more text is coming for the turn. Reports billing and timing for the completed turn.

1{
2 "type": "SpeechMetadata",
3 "speech_id": "dg_sp_a1b2c3d4e5f6",
4 "audio_duration_ms": 3200,
5 "input_character_count": 47,
6 "billable_character_count": 47,
7 "controls_applied": {
8 "pronunciations_applied": 0,
9 "breaks_applied": 0,
10 "pronunciation_warnings": 0
11 }
12}
FieldTypeDescription
speech_idstringServer-assigned turn identifier. Informational.
audio_duration_msintegerTotal audio duration produced for this turn, in milliseconds.
input_character_countintegerRaw input character count for this turn, before text normalization.
billable_character_countintegerBillable character count for this turn — the input minus stripped inline-control characters; always ≤ input_character_count.
controls_appliedobjectCounts of the inline controls the server acted on this turn: pronunciations_applied (pronunciation overrides that took effect), breaks_applied (pauses that took effect), and pronunciation_warnings (entries that failed validation). A control that was rejected or dropped is reported through a Warning and not counted here. Inline controls are coming soon on Flux TTS; all three counts report 0 until they ship.

Per-turn vs. cumulative. Per-turn counts are reported here, once per turn (at Flush). Cumulative totals are reported once, at session end, in SessionMetadata as total_*.

SpeechInterrupted

Sent in response to an Interrupt. Reports exactly what the user heard and what they didn’t, plus a nested metadata block carrying the same shape as a standalone SpeechMetadata body.

1{
2 "type": "SpeechInterrupted",
3 "audio_played_ms": 2340,
4 "text_spoken": "Sure, I can help you cancel your subscription.",
5 "text_remaining": " Let me pull up your account.",
6 "metadata": {
7 "speech_id": "dg_sp_a1b2c3d4e5f6",
8 "audio_duration_ms": 2340,
9 "input_character_count": 47,
10 "billable_character_count": 47,
11 "controls_applied": {
12 "pronunciations_applied": 0,
13 "breaks_applied": 0,
14 "pronunciation_warnings": 0
15 }
16 }
17}
FieldTypeDescription
audio_played_msintegerHow much audio the client had played when the interrupt landed, in milliseconds from the start of the session. Echoes Interrupt.playback_offset when supplied; otherwise the server’s own count of audio generated so far. When you interrupt without an offset, use this as the baseline your next playback_offset must advance past.
text_spokenstring (optional)The portion of the turn’s text the user heard, aligned against audio_played_ms. Omitted when the Interrupt carried no playback_offset.
text_remainingstring (optional)The portion the user did not hear. Omitted under the same condition.
metadataobjectPer-turn billing/timing for the interrupted turn — the same body as a standalone SpeechMetadata.

One event per interrupted turn. On Interrupt, only SpeechInterrupted fires — the server does not also emit a standalone SpeechMetadata. Read SpeechMetadata.<field> for completed turns and SpeechInterrupted.metadata.<field> for interrupted ones. Feed text_spoken back into your LLM context so the next turn doesn’t repeat what the user already heard.

Flushed

Emitted when the turn’s buffer has actually been flushed after a manual Flushnot on receipt of the Flush, and it can be held back behind earlier pending turns. The turn’s SpeechMetadata follows.

1{
2 "type": "Flushed",
3 "speech_id": "dg_sp_a1b2c3d4e5f6"
4}

SessionMetadata

Final server message before the WebSocket closes. Reports cumulative session totals — the sum across all turns.

1{
2 "type": "SessionMetadata",
3 "total_audio_duration_ms": 184500,
4 "total_input_character_count": 4280,
5 "total_billable_character_count": 4280
6}

An Interrupt rebases total_audio_duration_ms onto the audio the client actually played — audio generated past the interrupt point stops counting toward the session, so the total can decrease after a barge-in.

This is the one place cumulative totals are reported. Combined with the per-turn numbers in SpeechMetadata, you get clean reconciliation: per-turn for granular tracking, plus a final authoritative total.

ConfigureSuccess / ConfigureFailure

ConfigureSuccess

Sent when a Configure message is accepted. Echoes the applied configuration. Fires on receipt and validation, not on application — the change takes effect at the next segment boundary.

1{
2 "type": "ConfigureSuccess",
3 "applied": {
4 "speed": 1.15
5 }
6}

ConfigureFailure

Sent when a Configure message is rejected. The failing message has no effect — the prior configuration is retained and synthesis continues uninterrupted.

1{
2 "type": "ConfigureFailure",
3 "code": "SPEED_OUT_OF_RANGE",
4 "field": "speed",
5 "value": 3.5,
6 "description": "speed must be between 0.85 and 1.15 in 0.05 increments"
7}

field and value identify the rejected field and the value you sent; they are present only when the failure is tied to a specific field/value. See the ConfigureFailure codes below.

Warning

Informational message; synthesis continues and the connection is unaffected. Every warning carries a code and a human-readable description.

1{
2 "type": "Warning",
3 "code": "NO_ACTIVE_SPEECH",
4 "description": "There is no active turn. The request will be ignored."
5}

See the warning codes below. Warnings are not rate-limited — every occurrence is emitted.

Error

A fatal, server-originated error. Unlike a Warning, an Error is always followed by a WebSocket close.

1{
2 "type": "Error",
3 "code": "MESSAGE-0000",
4 "description": "The message could not be parsed."
5}

See the error codes below.

Warning codes

All warning codes follow Deepgram’s SCREAMING_SNAKE_CASE convention; the session stays open in every case.

Turn-scoped:

CodeTrigger
NO_ACTIVE_SPEECHA Flush arrived with no active turn. The request is ignored.
NO_SYNTHESIZABLE_TEXTThe turn’s text was entirely whitespace or punctuation. No audio is produced; the turn completes with a zero-duration SpeechMetadata.
SYNTHESIS_RETRYINGA synthesis request to the model failed and is being retried. The session continues; a fatal Error is sent only if retries are exhausted.

Inline controls and markup (inline pause and pronunciation controls are coming soon; their codes take effect when they ship):

CodeTrigger
INPUT_MARKUP_STRIPPEDRecognized SSML / competitor markup was stripped from Speak.text before synthesis. See Markup handling.
PRONUNCIATION_WARNINGSOne or more inline pronunciation strings failed IPA validation. Failing entries are dropped; valid entries still apply.
PRONUNCIATION_TOO_LONGA pronunciation’s IPA string exceeded the maximum length and was dropped.
PRONUNCIATIONS_LIMIT_EXCEEDEDMore than 500 pronunciation controls in one request. The offending text is dropped.
BREAKS_LIMIT_EXCEEDEDMore than 50 pause controls in one request, or two pauses with no intervening text. The offending text is dropped.
BREAK_TOKENS_OUT_OF_RANGEOne or more pause tokens specified an out-of-range duration and were ignored.
BREAK_TOKENS_WITH_INVALID_INCREMENTSOne or more pause tokens specified a duration off the 0.1s increment and were ignored.

Interrupt-scoped (in every case the Interrupt is ignored and no SpeechInterrupted is sent):

CodeTrigger
NO_AUDIO_GENERATEDThe Interrupt arrived before the session produced any audio — there is nothing to interrupt.
INTERRUPT_IN_PROGRESSAn earlier Interrupt is still being processed. At most one is handled at a time.
INVALID_INTERRUPT_OFFSETThe playback_offset did not advance past the position a prior interrupt established.

ConfigureFailure codes

CodeTrigger
SPEED_OUT_OF_RANGEspeed is not one of the published multipliers (0.851.15 in 0.05 steps). Prior config retained.
SPEED_NOT_SUPPORTEDspeed sent on a model/language that does not support runtime speed control.

Connection rejection codes

An invalid expressivity value rejects the connection with an HTTP 400 before the WebSocket upgrade completes — no Connected message is sent. See Expressivity.

CodeTrigger
EXPRESSIVITY_OUT_OF_RANGEexpressivity was outside the -2 to 2 range.
EXPRESSIVITY_INCREMENT_INVALIDexpressivity was not a whole number (e.g. 1.5).

Error codes

Every error is fatal and is followed by a WebSocket close frame. Codes use Deepgram’s DOMAIN-NNNN convention.

CodeErrorTrigger
MESSAGE-0000Unparseable client messageA client message could not be parsed.
DATA-0000Invalid commandA message contained an invalid command.
DATA-0002Malformed inline controlSpeak.text carried a malformed inline control. A control that is merely out of range or over a limit produces a Warning instead.
BIG-0000Message too largeA message was too large to process.
NET-0000Internal server errorThe server hit an unexpected condition.
NET-0001Failed to receive messageThe server failed to receive a message.
NET-0002Failed to send messageThe server failed to send a message. In practice you won’t observe this — if the server can’t send messages, it can’t deliver this error either.
NET-0003Time limit exceededThe session time limit (1 hour) was exceeded.
NET-0004Inactive clientNo client message arrived within the 60s inactivity window; the session was closed. Send a WebSocket Ping or Pong to keep an idle session alive.