Deepgram TTS
The Deepgram TTS provider enables your agent to use Deepgram's high-quality text-to-speech models for generating natural, expressive voice output with advanced voice capabilities.
Installation
Install the Deepgram-enabled VideoSDK Agents package:
pip install "videosdk-plugins-deepgram"
Importing
from videosdk.plugins.deepgram import DeepgramTTS
Authentication
The Deepgram plugin requires an Deepgram API key.
Set DEEPGRAM_API_KEY
in your .env
file.
Example Usage
from videosdk.plugins.deepgram import DeepgramTTS
from videosdk.agents import CascadingPipeline
# Initialize the Deepgram TTS model
tts = Deepgram(
# When DEEPGRAM_API_KEY is set in .env - DON'T pass api_key parameter
api_key="your-deepgram-api-key",
model="aura-asteria-en",
encoding="linear16", # linear16, mulaw, alaw, opus, mp3, flac, aac
sample_rate=24000
)
# Add tts to cascading pipeline
pipeline = CascadingPipeline(tts=tts)
note
When using .env file for credentials, don't pass them as arguments to model instances or context objects. The SDK automatically reads environment variables, so omit api_key, videosdk_auth, and other credential parameters from your code.
Configuration Options
model
: The Deepgram model to use (e.g.,"aura-asteria-en"
,"aura-luna-en"
)api_key
: Your Deepgram API key (can also be set via environment variable)encoding
: (str) Encoding allows you to specify the expected encoding of your audio output (default :"linear16"
)sample_rate
: (int) Sample rate for output (default:24000
)
Additional Resources
The following resources provide more information about using Deepgram with VideoSDK Agents SDK.
- Deepgram docs: Deepgram TTS docs.
Got a Question? Ask us on discord