Overview
Deepgram provides four STT service implementations:DeepgramSTTServicefor real-time speech recognition using Deepgram’s standard WebSocket API with support for interim results, language detection, and voice activity detection (VAD)DeepgramFluxSTTServicefor advanced conversational AI with Flux capabilities including intelligent turn detection, eager end-of-turn events, and enhanced speech processing for improved response timingDeepgramSageMakerSTTServicefor real-time speech recognition using Deepgram Nova models deployed on AWS SageMaker endpoints via HTTP/2 bidirectional streamingDeepgramFluxSageMakerSTTServicefor advanced conversational AI using Deepgram Flux models deployed on AWS SageMaker endpoints with native turn detection and low-latency streaming
Deepgram STT API Reference
Pipecat’s API methods for standard Deepgram STT
Deepgram Flux API Reference
Pipecat’s API methods for Deepgram Flux STT
Standard STT Example
Complete example with standard Deepgram STT
Flux STT Example
Complete example with Deepgram Flux STT
SageMaker Example
Complete example with Deepgram Nova on SageMaker
Flux SageMaker Example
Complete example with Deepgram Flux on SageMaker
Deepgram Documentation
Official Deepgram documentation and features
Deepgram Console
Access API keys and transcription models
Installation
To use Deepgram STT services, install the required dependencies:Prerequisites
Deepgram Account Setup
Before usingDeepgramSTTService or DeepgramFluxSTTService, you need:
- Deepgram Account: Sign up at Deepgram Console
- API Key: Generate an API key from your console dashboard
- Model Selection: Choose from available transcription models and features
Required Environment Variables
DEEPGRAM_API_KEY: Your Deepgram API key for authentication
AWS SageMaker Setup
Before usingDeepgramSageMakerSTTService or DeepgramFluxSageMakerSTTService, you need:
- AWS Account: With credentials configured (via environment variables, AWS CLI, or instance metadata)
- SageMaker Endpoint: A deployed SageMaker endpoint with a Deepgram model (Nova for standard service, Flux for advanced turn detection)
- Deepgram SDK: The Deepgram SDK may be needed for certain advanced configurations
DeepgramSTTService
str
required
Deepgram API key for authentication.
str
default:"\"\""
Custom Deepgram API base URL. Leave empty for the default endpoint. Supports
wss://, https://, ws://, http://, or bare hostname (defaults to
secure). Preserves the specified scheme, useful for air-gapped or private
deployments that don’t use TLS.str
default:"linear16"
Audio encoding format.
int
default:"1"
Number of audio channels.
bool
default:"False"
Transcribe each audio channel independently.
int
default:"None"
Audio sample rate in Hz. When
None, uses the pipeline’s configured sample
rate.str
default:"None"
Callback URL for async transcription delivery.
str
default:"None"
HTTP method for the callback (
"GET" or "POST").Any
default:"None"
Custom billing tag.
bool
default:"None"
Opt out of the Deepgram Model Improvement Program.
LiveOptions
default:"None"
deprecated
Legacy configuration options. Deprecated in v0.0.105. Use
settings=DeepgramSTTService.Settings(...) for runtime-updatable fields and
direct constructor parameters for connection-level config instead.DeepgramSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. See Settings
below.
Dict
default:"None"
Additional Deepgram features to enable.
bool
default:"True"
deprecated
Whether to interrupt the bot when Deepgram VAD detects user speech.
Deprecated in v0.0.99. Will be removed along with
vad_events support.float
default:"DEEPGRAM_TTFS_P99"
P99 latency from speech end to final transcript in seconds. Override for your
deployment.
Settings
Runtime-configurable settings passed via thesettings constructor argument using DeepgramSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.
Usage
With Custom Settings
Notes
- Finalize on VAD stop: When the pipeline’s VAD detects the user has stopped speaking, the service sends a finalize request to Deepgram for faster final transcript delivery.
- Deprecated vad_events: The
vad_eventssetting is deprecated. Use Silero VAD instead. - Multilingual support: Deepgram Nova models support many languages. The default is
Language.EN(English). Setlanguage="multi"in settings to enable multilingual transcription, which will detect and transcribe multiple languages within the same audio stream.
Event Handlers
Supports the standard service connection events (on_connected, on_disconnected, on_connection_error), plus:
DeepgramFluxSTTService
Since Deepgram Flux provides its own user turn start and end detection, you
should use
ExternalUserTurnStrategies to let Flux handle turn management.
See User Turn
Strategies for
configuration details.str
required
Deepgram API key for authentication.
str
default:"wss://api.deepgram.com/v2/listen"
WebSocket URL for the Deepgram Flux API.
int
default:"None"
Audio sample rate in Hz. When
None, uses the pipeline’s configured sample
rate.str
default:"flux-general-en"
deprecated
Deepgram Flux model to use for transcription. Deprecated in v0.0.105. Use
settings=DeepgramFluxSTTService.Settings(...) instead.bool
default:"None"
Opt out of the Deepgram Model Improvement Program.
str
default:"linear16"
Audio encoding format required by the Flux API. Must be
"linear16".list
default:"None"
Tags to label requests for identification during usage reporting.
InputParams
default:"None"
deprecated
Legacy configuration options. Deprecated in v0.0.105. Use
settings=DeepgramFluxSTTService.Settings(...) instead.DeepgramFluxSTTService.Settings
default:"None"
Configuration settings for the Flux API. See Settings below.
bool
default:"True"
Whether the bot should be interrupted when Flux detects user speech.
Settings
Runtime-configurable settings passed via thesettings constructor argument using DeepgramFluxSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.
Parameters marked with ✓ in the “On-the-fly” column can be updated mid-stream
using
STTUpdateSettingsFrame without requiring a WebSocket reconnect.Usage
With EagerEndOfTurn
Updating Settings Mid-Stream
Thekeyterm, eot_threshold, eager_eot_threshold, and eot_timeout_ms settings can be updated on-the-fly using STTUpdateSettingsFrame:
Configure message to Deepgram over the existing WebSocket connection, allowing you to adjust turn detection behavior and key terms without interrupting the conversation.
Notes
- Turn management: Flux provides its own turn detection via
StartOfTurn/EndOfTurnevents and broadcastsUserStartedSpeakingFrame/UserStoppedSpeakingFramedirectly. UseExternalUserTurnStrategiesto avoid conflicting VAD-based turn management. - On-the-fly configuration: Supports updating
keyterm,eot_threshold,eager_eot_threshold, andeot_timeout_msmid-stream viaSTTUpdateSettingsFrame. These updates are sent asConfiguremessages over the existing WebSocket connection without requiring a reconnect. - EagerEndOfTurn: Enabling
eager_eot_thresholdprovides faster response times by predicting end-of-turn before it is confirmed. EagerEndOfTurn transcripts are pushed asInterimTranscriptionFrames. If the user resumes speaking, aTurnResumedevent is fired.
Event Handlers
Supports the standard service connection events (on_connected, on_disconnected, on_connection_error), plus turn-level events for more granular conversation tracking:
(service, transcript) where transcript is the current transcript text. The on_turn_resumed event receives only (service).
DeepgramSageMakerSTTService
str
required
Name of the SageMaker endpoint with Deepgram model deployed.
str
required
AWS region where the SageMaker endpoint is deployed (e.g.,
"us-east-2").str
default:"linear16"
Audio encoding format.
int
default:"1"
Number of audio channels.
bool
default:"False"
Transcribe each audio channel independently.
int
default:"None"
Audio sample rate in Hz. When
None, uses the pipeline’s configured sample
rate.bool
default:"None"
Opt out of the Deepgram Model Improvement Program.
LiveOptions
default:"None"
deprecated
Legacy configuration options. Deprecated in v0.0.105. Use
settings=DeepgramSageMakerSTTService.Settings(...) instead.DeepgramSageMakerSTTService.Settings
default:"None"
Runtime-configurable settings for the STT service. See Settings
below.
float
default:"DEEPGRAM_SAGEMAKER_TTFS_P99"
P99 latency from speech end to final transcript in seconds. Override for your
deployment.
Settings
Runtime-configurable settings passed via thesettings constructor argument using DeepgramSageMakerSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.
The SageMaker service inherits all settings from DeepgramSTTService.Settings. See DeepgramSTTService Settings above for the full list.
Usage
Notes
- Finalize on VAD stop: Like
DeepgramSTTService, the SageMaker service sends a finalize request when the pipeline’s VAD detects the user has stopped speaking. - SageMaker deployment: Requires a Deepgram model deployed to an AWS SageMaker endpoint. See the Deepgram SageMaker deployment guide for setup instructions.
- Keepalive: Automatically sends KeepAlive messages every 5 seconds to maintain the connection during periods of silence.
Event Handlers
Supports the standard service connection events (on_connected, on_disconnected, on_connection_error).
DeepgramFluxSageMakerSTTService
Since Deepgram Flux provides its own user turn start and end detection, you
should use
ExternalUserTurnStrategies to let Flux handle turn management.
See User Turn
Strategies for
configuration details.str
required
Name of the SageMaker endpoint with Deepgram Flux model deployed (e.g.,
"my-deepgram-flux-endpoint").str
required
AWS region where the endpoint is deployed (e.g.,
"us-east-2").str
default:"linear16"
Audio encoding format. Must be
"linear16".int
default:"None"
Audio sample rate in Hz. When
None, uses the pipeline’s configured sample
rate.bool
default:"None"
Opt out of the Deepgram Model Improvement Program.
list
default:"None"
Tags to label requests for identification during usage reporting.
bool
default:"True"
Whether to interrupt the bot when Flux detects user speech.
DeepgramFluxSageMakerSTTService.Settings
default:"None"
Runtime-configurable settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using DeepgramFluxSageMakerSTTService.Settings(...). These can be updated mid-conversation with STTUpdateSettingsFrame. See Service Settings for details.
The Flux SageMaker service inherits all settings from DeepgramFluxSTTService.Settings with the same on-the-fly configuration support:
Parameters marked with ✓ in the “On-the-fly” column can be updated mid-stream
using
STTUpdateSettingsFrame without requiring a session restart. These
updates are sent as Configure messages to the Flux model over the existing
connection.Usage
With Custom Settings
Updating Settings Mid-Stream
Thekeyterm, eot_threshold, eager_eot_threshold, and eot_timeout_ms settings can be updated on-the-fly:
Notes
- Turn management: Flux provides native turn detection via
StartOfTurn/EndOfTurnevents and broadcastsUserStartedSpeakingFrame/UserStoppedSpeakingFramedirectly. UseExternalUserTurnStrategiesto avoid conflicting VAD-based turn management. - On-the-fly configuration: Supports updating
keyterm,eot_threshold,eager_eot_threshold, andeot_timeout_msmid-stream viaSTTUpdateSettingsFrame. These updates are sent asConfiguremessages over the existing HTTP/2 connection without requiring a reconnect. - EagerEndOfTurn: Enabling
eager_eot_thresholdprovides faster response times by predicting end-of-turn before it is confirmed. EagerEndOfTurn transcripts are pushed asInterimTranscriptionFrames. If the user resumes speaking, aTurnResumedevent is fired. - SageMaker deployment: Requires a Deepgram Flux model deployed to an AWS SageMaker endpoint. Unlike Nova models, Flux provides native turn detection and does not require external VAD.
- No KeepAlive needed: The Flux protocol uses a watchdog mechanism that sends silence when needed to maintain the connection, so manual KeepAlive messages are not required.
Event Handlers
Supports the standard service connection events (on_connected, on_disconnected, on_connection_error), plus turn-level events for granular conversation tracking:
(service, transcript) where transcript is the current transcript text. The on_turn_resumed event receives only (service).