Skip to main content
POST
Stream speech (SSE)
Streams synthesis as Server-Sent Events so you can start playing audio before the full clip is ready. The request body is identical to /speak; the response is an text/event-stream body instead of a single file.

Authorization

string
required
Your workspace API key (flv_…).

Path parameters

string
required
The voice id.

Body

string
required
The text to synthesize. Maximum 10,000 characters.
string
BCP-47 language code (for example en, hi). Defaults to the voice’s primary language.
string
Chunk encoding. One of s16le, s24le, s32le, f32le, f64le (raw, headerless PCM). Chunks arrive as base64-encoded PCM either way; the format decides the sample width.
integer
default:24000
Output sample rate in Hz. Defaults to the provider’s native rate (24000); values above it are upsampled. The effective rate is reported in the start event.
integer
default:32
Number of inference steps, 1–32 (a quality/latency trade-off). Provider default (32) if omitted.
number
Style/expressiveness control, 0.0–1.0. Provider default if omitted.

Response headers

string
text/event-stream (with Cache-Control: no-cache and X-Accel-Buffering: no so proxies don’t buffer the stream).
string
Your remaining character allowance for the month (present when billing is active). Streaming is metered per character of text, same as /speak.

Event format

Each event is delimited per the SSE spec (event: line, data: JSON line, blank line):
event
Sent once at the beginning. sample_rate is the effective output rate and audio_format the PCM encoding of the chunks - use these (not what you requested) to configure playback.
event
One per audio chunk, in order. index is the 0-based position; audio_b64 is base64-encoded raw PCM audio to append to your buffer.
event
Sent once when synthesis is complete; no more chunks follow. Carries audio_duration_s (total seconds of audio), and - when object storage is enabled - generation_id and a public audio_url of the full clip as a WAV file, so you can link or re-download it without reassembling the chunks.
event
Sent if synthesis fails. Includes a provider code and message. The stream ends after it.
Streaming requires the streaming feature on your plan; without it the request returns 403 when billing enforcement is active, and an exhausted character allowance returns 402 - see Errors. Streamed synthesis is never served from cache.

Prompt

Copy this into your coding agent (Claude Code, Cursor, Codex…) to implement this endpoint.