Deepgram CLI — Getting Started
The dg CLI lets you transcribe files, stream live audio, synthesize speech, analyze text, and manage your Deepgram account from the terminal.
Prerequisites
Section titled “Prerequisites”- Python 3.10 or later
- A Deepgram API key (get one free)
Quick Start
Section titled “Quick Start”Core Workflows
Section titled “Core Workflows”Transcribe audio
Section titled “Transcribe audio”Text-to-speech
Section titled “Text-to-speech”Text intelligence
Section titled “Text intelligence”Account management
Section titled “Account management”Account commands are flag-based. Run dg keys --help or dg projects --help for the full set.
Output Formats
Section titled “Output Formats”The CLI defaults to human-readable output in the terminal. Use -o or --output to switch formats:
-o belongs to dg itself, so it goes before the subcommand name. After the subcommand it fails to parse and exits 1. On dg speak the collision is quieter: there, a bare -o is the output file path, not a format.
Agent-friendly mode selects JSON on its own, without -o. A piped stdout alone does not trigger it.
For dg -o json listen, parse errors and progress output go to stderr, so redirecting stderr leaves stdout carrying the payload:
Some command-level errors still print to stdout — an authentication failure is the common one — so check the exit code rather than assuming stdout parses.
Exit Codes
Section titled “Exit Codes”Most command and usage outcomes use these exit codes, so scripts and CI steps can branch on them:
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Command, execution, or usage error, such as an unknown command or invalid flag |
2 |
Root-level user interrupt |
Agent-Friendly Mode
Section titled “Agent-Friendly Mode”The CLI auto-detects AI agent environments, including Claude Code, Aider, and OpenAI Codex, and adjusts its behavior:
- Disables interactive prompts
- Defaults to JSON output
To force the mode on:
--agent-friendly does something different on a subcommand: it prints that command’s parameter documentation as JSON and exits without running it.
Other Commands
Section titled “Other Commands”The CLI also includes commands for models, requests, profiles, updates, debugging, starter scaffolding, audio probing, and coding-assistant skills:
Next Steps
Section titled “Next Steps”- Install the CLI — More installation methods including pip, pipx, and Homebrew
- Authenticate — Learn about authentication options
- Speech-to-Text — Full transcription reference
- Text-to-Speech — Full TTS reference