deepgram/deepgram-python-sdk
Official Python SDK for Deepgram.
What it solves
This SDK provides a unified Python interface to access Deepgram's AI models for speech-to-text, text-to-speech, and language understanding. It simplifies the process of integrating high-performance audio AI into applications, handling the complexities of API requests, WebSocket connections for real-time streaming, and authentication.
How it works
The SDK offers both synchronous and asynchronous clients (DeepgramClient and AsyncDeepgramClient) to interact with Deepgram's APIs. It supports:
- Speech-to-Text (Listen): Transcribing pre-recorded files or streaming live audio via WebSockets for real-time recognition.
- Text-to-Speech (Speak): Generating natural-sounding audio from text strings.
- Text Intelligence (Read): Analyzing text for sentiment, topics, intents, and summarization.
- Conversational AI (Agent): Orchestrating a full voice agent loop (listening, thinking via LLMs like GPT-4o-mini, and speaking).
Who it’s for
Developers building voice-enabled applications, real-time transcription services, AI voice agents, or tools that require automated text analysis of spoken content.
Highlights
- Real-time Streaming: Built-in WebSocket support for low-latency speech recognition and voice agents.
- Agentic Workflow: Ability to configure a complete voice agent with custom providers for listening, thinking, and speaking.
- Flexible Transport: Support for custom transports, including a dedicated SageMaker transport for running models on AWS endpoints.
- Async Support: Full
async/awaitimplementation for non-blocking I/O operations. - Robust Error Handling: Detailed
ApiErrorexceptions and automatic retries with exponential backoff.