Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
SarvamAISTT
Sarvam AI speech-to-text plugin using the saaras:v3 model. Streams PCM audio to the Sarvam AI transcription API and emits text transcripts. Supports 23 Indic languages, multiple transcription modes (transcribe, translate, verbatim, translit, codemix), and optional server-side VAD controls.Constructor
Sarvam AI API key. Falls back to the
SARVAM_API_KEY environment variable when None.Transcription model ID. Defaults to
'saaras:v3', the current model with multi-mode support. 'saarika:v2.5' is the alternative option.BCP-47 language code for the spoken audio. Defaults to
'en-IN'. Supported values include 'hi-IN', 'bn-IN', 'kn-IN', 'ml-IN', 'mr-IN', 'od-IN', 'pa-IN', 'ta-IN', 'te-IN', 'gu-IN', 'as-IN', 'ur-IN', 'ne-IN', and others. Use 'unknown' for automatic language detection.Sample rate (Hz) of the incoming audio. Defaults to
48000 (the standard capture rate).Sample rate (Hz) expected by the Sarvam API. Defaults to
16000. PCM audio is resampled as needed.Transcription mode passed to the API.
None (default) uses the API default ('transcribe'). Other saaras:v3 values: 'translate' (Indic → English), 'verbatim' (no normalisation), 'translit' (Romanisation), 'codemix' (mixed-script output).When
True, increases server-side VAD sensitivity to detect quieter speech. None lets the API choose.When
True, enables end-of-utterance flush signals so the server emits partial transcripts at turn boundaries. None lets the API choose.When
True, requests translation of the transcript to English (shorthand for mode='translate'). Defaults to False.Optional text hint that biases transcription towards domain-specific vocabulary or proper nouns.
Codec identifier for PCM audio sent to the API. Defaults to
'pcm_s16le'. Other PCM variants: 'pcm_l16', 'pcm_raw'.When
True (default), the server emits VAD activity signals alongside transcripts.Probability threshold (0–1) above which a frame is considered speech.
None uses the API default.Probability threshold (0–1) below which a frame is considered silence.
None uses the API default.Minimum consecutive speech frames required before an utterance is opened.
None uses the API default.Override for
min_speech_frames on the very first turn only. None uses the API default.Number of audio frames prepended to each utterance to avoid clipping the first phoneme.
None uses the API default.Minimum speech frames to trigger an interruption signal.
None uses the API default.aclose
emit
The event to emit.
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_stt_transcript
An async callable that receives each
STTResponse.process_audio
Raw audio bytes to transcribe.
Optional language code to guide recognition.
stream_transcribe
An async iterator yielding raw audio byte chunks.
STTResponse: Transcription events produced as audio is consumed.