Stream Speech
/v1/audio/speech/streamOverview
Streams text to an exact provider speech model over WebSocket and forwards the provider's native audio, timing, and completion frames.
Routing and provider details
Reviewed streaming contracts are funded before connecting to the provider. Sessions are limited to five minutes, 8,000 submitted characters and 32 MiB of output. Final native completion settles the frozen tariff; interrupted or ambiguous outcomes retain the reservation. Use the exact supported selector and provider-native control frames below.
Authenticate the HTTP upgrade with Authorization: Bearer <api-key>.
Native browser WebSocket cannot set that header; use a trusted server or
a WebSocket client that supports custom upgrade headers. Never put an API
key in the URL. The first client frame must be a
session.start object with an exact Alibaba Qwen3 realtime, Amazon Polly,
ElevenLabs, Cartesia, Deepgram, Hume, Inworld, MiniMax, Murf, Soniox, or
xAI model. session.start accepts provider.data_region, as a request does.
Alibaba accepts native input_text_buffer.append,
input_text_buffer.commit, input_text_buffer.clear, and
session.finish events. Its native session, response, base64 audio,
completion, usage, and error objects are forwarded unchanged. Qwen3
Flash uses built-in voices; Instruct adds common instructions and
optimize_instructions; VC and VD require a custom voice ID created for
the exact Alibaba enrollment model.
Amazon Polly uses its generative-only HTTP/2 bidirectional stream. Send
{ "type": "input_text", "text": "...", "flush": true }, optional
{ "type": "flush" }, then { "type": "session.finish" }; audio is
emitted as base64 audio events and the final provider character count
is emitted as stream.closed.
ElevenLabs standard and multi-context payloads are proxied according to
their native protocols. Cartesia accepts its current generation and
cancellation payloads, supports multiplexed context IDs, and uses the
AudioLab-only { "type": "session.finish" } control to drain active
contexts and settle the session.
Deepgram accepts native Speak,
Flush, Clear, and Close controls; raw upstream audio is emitted as
{ "type": "Audio", "audio": "<base64>" }, while Metadata, Flushed,
Cleared, and Warning objects retain their native fields. Its start frame
requires a full Aura voice id (for example aura-2-thalia-en) and a
pcm, ulaw, or alaw response format. session.finish
maps to Deepgram's graceful Close.
Hume accepts native InputMessage text,
voice, description, speed, trailing-silence, flush, and close controls;
session.finish maps to Hume's native close:true.
Inworld supports up
to five multiplexed contexts using native create, send_text,
flush_context, and close_context objects; AudioLab forwards native
context, audio, alignment, usage, and status results, and session.finish
drains all open contexts. Inworld TTS-2 start-frame instructions are
translated to bracketed steering on the first text frame in each context;
TTS 1.5 Max and Mini reject steering.
xAI accepts native text.delta,
text.done, and text.clear controls across multiple utterances on one
connection; use session.finish after the last audio.done or
audio.clear.
MiniMax accepts text or native task_continue frames,
maps session.finish to task_finish, and forwards task_continued,
task_finished, and task errors.
Murf accepts native text, voice_config,
clear, context_id, end, min_buffer_size, and max_buffer_delay_in_ms
fields (including camelCase voiceId), multiplexes independent contexts, and forwards native base64
audio and final events.
Soniox tts-rt-v2 accepts {"text":"...","text_end":true} after
session.start. session.finish ends input. Native audio_end followed by
terminated completes the stream; output is capped at two minutes and
charged by generated audio duration at the published tariff.
Provider audio, timing, alignment, flush, completion, and error objects are forwarded without changing their provider fields.
Responses
101WebSocket protocol upgrade accepted.
401Authentication is missing or invalid.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
403Authenticated principal lacks permission.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
429Rate limit exceeded.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
500Internal server error.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
502Upstream provider failed after allowed attempts.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
503No eligible provider endpoint is currently available, or async processing has no healthy worker polling the durable queue.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.