POST /v1/tts/stream synthesizes speech and streams the audio back as it is generated, so you can begin playback before the whole utterance is ready. It takes the same request body as the synchronous endpoint.
Request
Response format
The body is a chunked stream of raw audio, not a container file:
There is no WAV/RIFF header on the stream. To play it, point your audio sink at a 44.1 kHz mono s16le source, or prepend your own WAV header. The fully assembled WAV is uploaded to storage and its URL is returned in the
X-audio-url response header once the stream completes.
Response headers
Consuming the stream
Error handling
Because the HTTP status line is sent before synthesis begins, a200 only means the request was accepted, not that the whole stream succeeded. If generation fails partway, the stream simply ends early. Guard against truncation:
- Track how much audio you received and treat an unexpectedly short stream as a failure.
- Any credits charged for a failed generation are refunded automatically.
voice_id, text over 500 characters, missing key) happen before streaming starts and return a normal JSON error with the appropriate status code. See Errors & status codes.
For token-by-token input or sessions longer than a single 500-character utterance, use the WebSocket API instead.