Skip to main content

STT (Speech-to-Text)

STT is used in pipeline mode to transcribe caller audio before it reaches your LLM. If you use an engine such as OpenAIRealtime or ElevenLabsConvAI, speech recognition is handled internally by the engine and you do not configure STT separately. Each STT ships as both a namespaced class (from getpatter.stt import deepgramdeepgram.STT()) and a flat alias (from getpatter import DeepgramSTT). They are equivalent — pick whichever reads best. The flat aliases are convenient for short examples; the namespaced form avoids name collisions when you import several STTs together.

Quickstart

The same agent using namespaced imports:

Supported providers

Model enums

Each provider exports a typed StrEnum of valid model IDs alongside the provider class. They keep model= arguments tab-completable and reject typos at construction time, while still accepting raw strings for forward compatibility:

Deepgram

Streaming STT backed by Deepgram’s nova-3 model.

Whisper (OpenAI)

HTTP-based STT via OpenAI Whisper. Reuses OPENAI_API_KEY.
Whisper on mulaw 8 kHz routinely hallucinates short fillers ("you", ".", "thank you") and emits is_final=true on every chunk regardless of speech. The pipeline drops these by default plus duplicate / sub-500 ms back-to-back finals, but for production prefer OpenAITranscribeSTT (gpt-4o-transcribe) — same OPENAI_API_KEY, ~10× faster, no hallucination floor.

OpenAI Transcribe (gpt-4o-transcribe)

First-class STT for OpenAI’s gpt-4o-transcribe and gpt-4o-mini-transcribe models — drop-in replacement for WhisperSTT with stronger multilingual quality and significantly lower latency. Reuses OPENAI_API_KEY.

Cartesia

Streaming STT using Cartesia’s ink-whisper. See Cartesia setup.

AssemblyAI

Universal Streaming STT via the AssemblyAI v3 WebSocket API. See AssemblyAI setup.

Soniox

Real-time STT via Soniox.

Speechmatics

Real-time STT via Speechmatics (Python SDK only — not yet ported to TypeScript).

xAI

Real-time streaming STT via xAI (Grok), plus a one-shot batch transcription helper. Supports Smart Turn end-of-turn detection, keyterm biasing, and speaker diarization. See xAI STT setup.

Missing credentials

Each class raises ValueError at construction time if no API key is resolved from either api_key= or the matching env var:

What’s Next

LLM

Configure the language model.

TTS

Configure speech synthesis.