Which Text-to-Speech API to Use
Sarvam offers three text-to-speech APIs for the same Bulbul models: REST, HTTP stream and WebSocket. They differ in how audio is delivered and how interactive the connection is. Voices, languages and parameters are the same on all three.
Pick in ten seconds
The three APIs
How they compare
Delivery
Limits and defaults
All three accept the same codecs: wav, mp3, aac, flac, linear16, mulaw, alaw and opus. opus fails at the default 22,050 Hz, so set speech_sample_rate to 8000, 16000 or 24000 (and 48000 on REST).
Choosing between the two streaming APIs
Both streaming APIs return audio before the full clip is synthesized. The difference is control:
- HTTP stream is one request in and one stream out. Choose it when you already have the whole text, or when WebSockets are not available.
- WebSocket keeps one connection open, so you can send text in pieces as an LLM produces it and avoid reconnecting for each utterance. You also control buffering and flushing. Choose it for voice agents.