Streaming
Generate and play audio in real-time using chunked transfer encoding
Overview
The streaming endpoint delivers audio chunks as they’re generated, so your application can start playback before the full audio is ready. This is ideal for long-form content and low-latency applications.
Usage
Python
TypeScript
cURL
Supported audio formats
WAV format is not available for streaming. Use the speech endpoint for WAV output.
Use cases
Transform articles or blog posts into spoken audio for distribution
Convert on-screen text to spoken audio in real-time
Generate conversational responses with minimal latency
Process full chapters without hitting the 2K character limit
Error handling
If an error occurs during synthesis after the stream has started, the connection closes without an error message — this is a limitation of HTTP chunked responses. Errors before streaming starts return standard HTTP status codes.
To handle mid-stream failures:
- Check the total bytes received against expected audio length
- Implement retry logic for the remaining text
Example projects
See our Examples Repository for complete browser and server-side streaming demos.