Text-to-Speech
Streaming Text To Speech
Generate speech from text using real-time streaming, allowing audio playback to begin before the entire synthesis is complete.
This endpoint streams audio data in chunks, enabling low-latency audio playback for applications requiring immediate feedback.
Streaming Format:
- WAV format: First chunk contains WAV header (size=0xFFFFFFFF for streaming) followed by raw PCM data. Subsequent chunks contain only PCM data.
- MP3 format: Each chunk contains post-processed MP3 data that can be decoded independently.
Use Cases:
- Conversational AI, chatbots and real-time voice assistants
- Interactive applications requiring immediate audio feedback
- Long-form content where waiting for full synthesis is impractical
Request Parameters: Uses the same TTSRequest schema as the standard TTS endpoint. Set output.audio_format to "wav" or "mp3" to control the streaming format.
post/v1/text-to-speech/stream
Request
- Base URL: https://api.typecast.ai
- URL: https://api.typecast.ai/v1/text-to-speech/stream
- Auth: API key in header X-API-KEY
Request body
Example request
{
"text": "Everything is so incredibly perfect that I feel like I'm dreaming.",
"output": {
"audio_tempo": 1,
"target_lufs": -14,
"audio_format": "wav",
"remove_silence_ms": 100
},
"prompt": {
"next_text": "I am literally bursting with happiness and I never want this feeling to end!",
"emotion_type": "smart",
"previous_text": "I feel like I'm walking on air and I just want to scream with joy!"
},
"language": "eng",
"voice_id": "tc_60e5426de8b95f1d3000d7b5"
}Response
Success - Returns streaming audio data in chunks
Changes
No recorded changes to this operation across all 1 revision of this API.