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:| Property | Value |
|---|---|
| Content-Type | audio/L16 |
| Encoding | Signed 16-bit PCM, little-endian |
| Sample rate | 44100 Hz |
| Channels | 1 (mono) |
X-audio-url response header once the stream completes.
Response headers
| Header | Description |
|---|---|
X-inference-id | Unique id for the generation |
X-audio-url | URL of the assembled WAV (available after the stream finishes) |
Credit-Utilized | Credits charged for the request |
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.