Realtime Speech-to-Text API
Realtime Speech-to-Text API
Overview
saaras:v3-realtime is Sarvam’s WebSocket streaming model for voice agents and live transcription: real interim (partial) transcripts as the user speaks, plus millisecond-based VAD tuning.
How this differs from the legacy Streaming API
Connection parameters
Sent as query parameters on the WebSocket URL (or the matching keyword argument on connect() in the Python SDK).
Stream types
stream_type controls the tradeoff between partial-transcript latency and accuracy:
Getting started
Turn detection
vad(default): the server runs its own VAD and emitsvad.speech_start/vad.speech_endautomatically. Tune withthreshold,silence_duration_ms,min_speech_duration_ms.manual: the client delimits turns itself by sending{"event": "speech_start"}and{"event": "speech_end"}. VAD parameters have no effect. A{"event": "flush"}message force-finalizes buffered audio without waiting forspeech_end.
Language support
language_code is required. 24 values are accepted, including adaptive auto-detection:
Odia’s code changed. The legacy Streaming API uses od-IN for Odia; this endpoint uses or-IN.
With language_code="auto", transcript.partial and transcript.final include a detected language field (transcript.final also adds language_confidence). With a specific language_code, neither field is present.
Message reference
Client to server: audio_input ({"event": "audio_input", "audio": "<base64>"}), speech_start / speech_end / flush (manual mode only), config.update (change settings mid-call, see below), end (graceful close), ping (keepalive).
Server to client: session.begin (sent on connect), vad.speech_start / vad.speech_end, transcript.partial, transcript.final, config.updated, pong, session.end (includes audio_duration_s, the billed audio), error (code, is_fatal, message).
Live config updates
Change settings mid-call without reconnecting:
language_code, prompt, mode, stream_type, and endpointing apply at the next utterance boundary. threshold, silence_duration_ms, and min_speech_duration_ms apply immediately (vad mode only). encoding, sample_rate, and return_timestamps are connection-only.
Error handling
Best practices
- Use
stream_type="fast"for conversational agents; reach forsimulatedonly if you truly don’t need partials. - Drive barge-in off
vad.speech_startor early partials, nottranscript.final. - Reconfigure with
config.updateinstead of reconnecting when you can. - Reconcile billing against
session.end.audio_duration_s, the server-authoritative value.
Full endpoint reference: Realtime Streaming API reference.