Endpoint
POST /v1/audio/streamAuthentication
Bearer token required
Overview
The streaming endpoint converts text to speech and streams MP3 audio in real-time. This endpoint is ideal for applications requiring low-latency audio playback, such as real-time assistants or live caption-to-speech conversion.Response Format
audio/mpeg (chunked MP3)First Byte Latency
< 500ms
Request Parameters
The voice ID to use. Get available voices from the
voices endpoint.
Emotional speaking style. Options:
neutral, cheerful,
calm, angry, sad, excited,
whispering. Default: calmExamples
- curl
- Node.js
- Python
- JavaScript (Browser)
Response
The endpoint streams MP3 audio data with the following headers:audio/mpegchunkedError Responses
Best Practices
- Connection Management: Use HTTP/2 or keep-alive connections to reduce latency
- Back-pressure: Process chunks as they arrive to maintain stream health
- Error Recovery: Implement reconnection logic for network interruptions
- Browser Support: Use MediaSource API for optimal browser streaming
- Security: Keep your API key secure and never expose it in client-side code
Streaming vs Standard Endpoint
Use Streaming When
- Real-time playback is needed - Low latency is critical - Processing long texts - Building conversational apps
Use Standard When
- Saving audio to files - Offline caching - Simple playback - Short text snippets

