Skip to main content
Currently in beta. You’re on the priority waitlist and among the first to get access.

Overview

Stream audio in real-time with the lowest latency. Perfect for interactive assistants and live applications.
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


Connection Headers

All configuration is passed as WebSocket upgrade headers at connection time. Headers cannot be changed mid-session — reconnect with new headers to change settings.

Connection Flow

A WebSocket session follows a strict sequence:
  1. Client connects — opens a WebSocket to /api/v1/tts with all required headers.
  2. Client sends text — sends a JSON message with the text to synthesize and audio_config.
  3. Server streams audio — returns audio as binary chunks according to the requested audio_config.
  4. Server completes — synthesis finishes; the client may close the connection or send another request.
  5. Either side closes — client or server may close the connection at any time.
Send one synthesis request at a time and consume audio chunks as they arrive for the lowest end-to-end latency.

Request Parameters

Send a JSON text frame 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.5
string
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 is encoded into a single OGG Opus file and delivered as one chunk after synthesis completes.

Server Messages

The server streams audio data in real-time. Each binary chunk contains audio encoded in the format specified by audio_config.

Audio chunk

Binary frames containing synthesized audio. Append chunks in order to rebuild the full audio stream.

completed

Emitted when synthesis for the current request has finished.

error

Sent when the server encounters a recoverable or fatal error. The connection may remain open after a recoverable error.

Code Example


Python SDK

The SDK’s realtime client manages the WebSocket lifecycle, audio streaming, and async iteration so you can focus on your application logic.

Installation

Requires Python 3.10+.

Authentication

Stream Audio Chunks in Real-Time

Use the async context manager to open the connection and iterate over audio chunks as they arrive.

Collect All Audio at Once

If you don’t need to process chunks as they arrive, use synthesize_and_collect to get the full audio as a single bytes object.

Supported Languages

The Gnani Timbre v2.0 API supports 2 languages.