TTS Stream
Text-to-Speech (Streaming)
Stream audio in chunks as it’s generated via Server-Sent Events.
POST
TTS Stream
Currently in beta. You’re on the priority waitlist and among the first to get access.
Overview
Receive audio in chunks as it’s generated, allowing playback to start immediately. Reduces latency compared to TTS REST. For the lowest latency, see TTS Realtime.Passing numbers, IDs, dates, or currency as raw strings causes mispronunciations. See the Input Formatting Guide for correct formatting of phone numbers, account numbers, PINs, Aadhaar, vehicle registration numbers, GSTIN, currency, and more.
Available Voices
To see the available voices, click here.Endpoint
Authentication
All requests require the following headers:Request Parameters
Send a JSON body with the following structure:string
required
The text to synthesize into speech. Pass numbers, dates, and currency as spoken words to avoid mispronunciations — see Input Formatting Guide.
string
required
TTS model to use. Currently supported:
Timbre v2.0 / Timbre v2.5string
ID of a pre-defined voice. See Available Voices
integer
default:"48000"
Sample rate in Hz. Supported:
8000, 16000, 22050, 24000, 44100, 48000.integer
required
Number of audio channels (e.g.,
1 for mono, 2 for stereo)integer
required
Sample width in bytes (e.g.,
2 for 16-bit audio)string
default:"linear_pcm"
Audio encoding. Options:
linear_pcm, pcm_s16le, pcm_mulaw, pcm_alaw, oggopus. For telephony, prefer container=mulaw or container=alaw over this field — both produce the same output. Use oggopus (or container=ogg) for a playable OGG Opus file.string
default:"wav"
Output container. Options:
wav, raw, mp3, ogg, mulaw, alaw. Use ogg for OGG Opus. Use mulaw or alaw for G.711 telephony (forces 8000 Hz regardless of sample_rate).string
default:"128k"
MP3 bitrate. Only used when
container is mp3. Supported: 32k, 64k, 96k, 128k, 192k.Audio Format Reference
Encoding aliases — produce identical output to the
container rows above:
bitrate only applies when container=mp3. container=mulaw/alaw override sample_rate to 8000 Hz.
When
container=ogg or encoding=oggopus is requested, all audio chunks are encoded into a single OGG Opus file delivered as one chunk — streaming delivery is not possible for OGG.Response
The server streams audio as Server-Sent Events. Eachaudio_chunk event carries a base64-encoded audio fragment. A final completed event signals that synthesis is finished.
Code Example
Python SDK
The SDK’s streaming client handles SSE parsing and chunk reassembly for you — you just iterate and write.Installation
Authentication
Stream Audio to a File
synthesize_stream yields audio chunks as they arrive. Playback or writing can begin before the full response is complete.
With Custom Audio Config
Supported Languages
The Gnani Timbre v2.0 API supports 2 languages.Headers
Body
application/json
Request body for TTS inference.
Supported TTS models.
Available options:
timbre-v2.5, timbre-v2.0 Audio output configuration.
Voice name from the Timbre catalog.
Language code. Use IND-IN for Timbre v2.0. For Timbre v2.5 use auto, hi-IN, en-IN, ta-IN, te-IN, kn-IN, ml-IN, mr-IN, pa-IN, bn-IN, or gu-IN.
Playback speed multiplier (Timbre v2.5 only). Range: 0.85–1.15.
Response
Successful Server-Sent Events stream
The response is of type string.