Skip to main content

Deepgram STT

DeepgramSTT streams PCM (or mulaw / opus / flac) audio to Deepgram’s v1 /listen WebSocket endpoint. Pure websockets transport, no vendor SDK required. Handles KeepAlive pings, Finalize / CloseStream graceful shutdown, and surfaces both Results transcripts and SpeechStarted / UtteranceEnd VAD events.

Install

deepgram ships in the base install — no extra needed.

Usage

Use the namespaced import (getpatter.stt.deepgram) or the flat alias (getpatter.DeepgramSTT). Both auto-resolve DEEPGRAM_API_KEY from the environment when api_key= is omitted.
Plug it into an agent:

Models and rates

Deepgram bills per minute of streamed audio. Per-model rates (defaults from getpatter.pricing):
ModelRate / min
nova-3 (default)$0.0077
nova-3-multilingual$0.0092
nova-2$0.0058
nova$0.0043
whisper-large$0.0048
whisper-medium$0.0048
Override per-call via Patter(pricing={"deepgram": {"models": {"nova-2": {"price": ...}}}}).

Languages

language="en" by default. Pass any Deepgram-supported BCP-47 code (e.g. "es", "fr", "de", "it"). For mixed-language calls use nova-3-multilingual.

Telephony optimization

For Twilio (mulaw 8 kHz) use the carrier-aware factory so audio reaches Deepgram natively without an extra resample step:

Options

OptionDefaultNotes
api_keyNoneReads from DEEPGRAM_API_KEY when omitted.
model"nova-3"Any Deepgram model id.
language"en"BCP-47 code.
encoding"linear16""linear16", "mulaw", "alaw", "opus", "flac".
sample_rate160008000, 16000, 24000, 44100, 48000 Hz.
endpointing_ms150Silence (ms) before Deepgram closes a turn.
utterance_end_ms1000Server-side endpoint detection (min 1000).
smart_formatTruePunctuation + numerals.
interim_resultsTrueStream partial transcripts.
vad_eventsTrueEmit SpeechStarted / UtteranceEnd.

Low-level usage