Skip to main content

Overview

Deepgram provides four STT service implementations:
  • DeepgramSTTService for real-time speech recognition using Deepgram’s standard WebSocket API with support for interim results, language detection, and voice activity detection (VAD)
  • DeepgramFluxSTTService for advanced conversational AI with Flux capabilities including intelligent turn detection, eager end-of-turn events, multilingual support (with flux-general-multi model), and enhanced speech processing for improved response timing
  • DeepgramSageMakerSTTService for real-time speech recognition using Deepgram Nova models deployed on AWS SageMaker endpoints via HTTP/2 bidirectional streaming
  • DeepgramFluxSageMakerSTTService for 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:
For the SageMaker variant, install both the Deepgram and SageMaker dependencies:

Prerequisites

Deepgram Account Setup

Before using DeepgramSTTService or DeepgramFluxSTTService, you need:
  1. Deepgram Account: Sign up at Deepgram Console
  2. API Key: Generate an API key from your console dashboard
  3. 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 using DeepgramSageMakerSTTService or DeepgramFluxSageMakerSTTService, you need:
  1. AWS Account: With credentials configured (via environment variables, AWS CLI, or instance metadata)
  2. SageMaker Endpoint: A deployed SageMaker endpoint with a Deepgram model (Nova for standard service, Flux for advanced turn detection)
  3. 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.
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 the settings 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.
  • Multilingual support: Deepgram Nova models support many languages. The default is Language.EN (English). Set language="multi" in settings to enable multilingual transcription, which will detect and transcribe multiple languages within the same audio stream.
  • Runtime settings updates: Changing settings via STTUpdateSettingsFrame triggers a reconnection with the new parameters. To avoid audio loss, reconnection is deferred until the current user turn ends (i.e., until UserStoppedSpeakingFrame is received). Audio frames arriving during the reconnect are buffered and replayed once the new connection is ready.

Event Handlers

Supports the standard service connection events (on_connected, on_disconnected, on_connection_error).

DeepgramFluxSTTService

Deepgram Flux provides its own user turn start and end detection and automatically requests ExternalUserTurnStrategies at start, so you don’t need to configure turn strategies manually. Pass your own user_turn_strategies only to override the service’s recommendation. See User Turn Strategies for more 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.
float
default:"0.5"
Minimum silence duration in seconds before the watchdog sends silence to prevent dangling turns. The actual threshold is max(chunk_duration * 2, watchdog_min_timeout), adapting automatically to the audio chunk size in use.

Settings

Runtime-configurable settings passed via the settings 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

Multilingual Support

Updating Settings Mid-Stream

The keyterm, eot_threshold, eager_eot_threshold, eot_timeout_ms, and language_hints settings can be updated on-the-fly using STTUpdateSettingsFrame:
This sends a Configure message to Deepgram over the existing WebSocket connection, allowing you to adjust turn detection behavior, key terms, and language hints without interrupting the conversation.

Notes

  • Turn management: Flux provides its own turn detection via StartOfTurn/EndOfTurn events and broadcasts UserStartedSpeakingFrame/UserStoppedSpeakingFrame directly. The service automatically requests ExternalUserTurnStrategies at start to avoid conflicting VAD-based turn management.
  • VAD is optional: When Flux drives turn detection, a VAD (such as SileroVADAnalyzer) in your transport is not required for core functionality. Include one if you want useful STT metrics; omit it otherwise.
  • On-the-fly configuration: Supports updating keyterm, eot_threshold, eager_eot_threshold, eot_timeout_ms, and language_hints mid-stream via STTUpdateSettingsFrame. These updates are sent as Configure messages over the existing WebSocket connection without requiring a reconnect.
  • EagerEndOfTurn: Enabling eager_eot_threshold provides faster response times by predicting end-of-turn before it is confirmed. EagerEndOfTurn transcripts are pushed as InterimTranscriptionFrames. If the user resumes speaking, a TurnResumed event is fired.
  • Multilingual support: Use the flux-general-multi model with language_hints to bias transcription toward specific languages (EN, ES, FR, DE, HI, RU, PT, JA, IT, NL). TranscriptionFrame.language reflects the detected language for each turn. Omit hints for auto-detection or pass a subset to bias toward expected languages.

Event Handlers

Supports the standard service connection events (on_connected, on_disconnected, on_connection_error), plus turn-level events for more granular conversation tracking:
Turn events receive (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 the settings 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

Deepgram Flux provides its own user turn start and end detection and automatically requests ExternalUserTurnStrategies at start, so you don’t need to configure turn strategies manually. Pass your own user_turn_strategies only to override the service’s recommendation. See User Turn Strategies for more 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.
float
default:"0.5"
Minimum silence duration in seconds before the watchdog sends silence to prevent dangling turns. The actual threshold is max(chunk_duration * 2, watchdog_min_timeout), adapting automatically to the audio chunk size in use.
DeepgramFluxSageMakerSTTService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings 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

The keyterm, eot_threshold, eager_eot_threshold, eot_timeout_ms, and language_hints settings can be updated on-the-fly:

Notes

  • Turn management: Flux provides native turn detection via StartOfTurn/EndOfTurn events and broadcasts UserStartedSpeakingFrame/UserStoppedSpeakingFrame directly. The service automatically requests ExternalUserTurnStrategies at start to avoid conflicting VAD-based turn management.
  • VAD is optional: When Flux drives turn detection, a VAD (such as SileroVADAnalyzer) in your transport is not required for core functionality. Include one if you want useful STT metrics; omit it otherwise.
  • On-the-fly configuration: Supports updating keyterm, eot_threshold, eager_eot_threshold, eot_timeout_ms, and language_hints mid-stream via STTUpdateSettingsFrame. These updates are sent as Configure messages over the existing HTTP/2 connection without requiring a reconnect.
  • EagerEndOfTurn: Enabling eager_eot_threshold provides faster response times by predicting end-of-turn before it is confirmed. EagerEndOfTurn transcripts are pushed as InterimTranscriptionFrames. If the user resumes speaking, a TurnResumed event is fired.
  • Multilingual support: Use the flux-general-multi model with language_hints to bias transcription toward specific languages (EN, ES, FR, DE, HI, RU, PT, JA, IT, NL). TranscriptionFrame.language reflects the detected language for each turn. Omit hints for auto-detection or pass a subset to bias toward expected languages.
  • 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 dynamic watchdog mechanism that sends silence when needed to maintain the connection (threshold: max(chunk_duration * 2, watchdog_min_timeout)), 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:
Turn events receive (service, transcript) where transcript is the current transcript text. The on_turn_resumed event receives only (service).
The InputParams / params= / live_options= pattern is deprecated as of v0.0.105. Use Settings / settings= instead. See the Service Settings guide for migration details.