Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
CartesiaSTTModel
CartesiaSTT
Cartesia Speech-to-Text provider. Streams audio to Cartesia’sink-whisper STT model via WebSocket for
low-latency, real-time transcription. Supports 100+ languages in
ISO 639-1 format with configurable silence detection and volume
thresholds.
Constructor
Cartesia API key for authentication. Falls back to the
CARTESIA_API_KEY environment variable when omitted.Cartesia STT model identifier. Defaults to
"ink-whisper", which is the only currently available model. Accepts a CartesiaSTTModel enum value or a plain string.ISO 639-1 language code for the spoken audio. Defaults to
"en" (English). Over 100 languages are supported, including "fr", "de", "es", "zh", "ja", "pt", "ru", "ko", and "ar".Sample rate in Hz of the raw PCM audio sent to the WebSocket. Must match the capture rate of the audio source. Defaults to
48000 (the standard capture rate).Sample rate in Hz at which Cartesia processes audio internally. Defaults to
16000.PCM encoding format of the input audio stream. Defaults to
"pcm_s16le" (16-bit signed little-endian). Other valid options: "pcm_s32le", "pcm_f16le", "pcm_f32le", "pcm_mulaw", "pcm_alaw".Cartesia API version header in
"YYYY-MM-DD" format. Defaults to "2026-03-01".Minimum RMS volume threshold (
0.0–1.0) below which audio is treated as silence for automatic transcript finalization. Lower values capture quieter speech; higher values filter noisy environments. Defaults to None (Cartesia platform default). Only used by ink-whisper.Maximum duration of continuous silence in seconds before the transcript is automatically finalized. Lower values finalize faster; higher values allow longer pauses. Defaults to
None (Cartesia platform default). Only used by ink-whisper.Override the Cartesia WebSocket base URL. Defaults to
None (uses wss://api.cartesia.ai).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.