dev-tools 6 min read

Deepgram CLI: Speech-to-Text, TTS & Audio Analysis

The official Deepgram CLI brings transcription, text-to-speech, sentiment detection, and diarization to your terminal. Install with one line, stream live audio, pipe to LLMs. MIT.

By
Share: X in
Deepgram CLI product thumbnail showing terminal interface

TL;DR

TL;DR: The official Deepgram CLI (dg) brings speech-to-text, text-to-speech, and audio intelligence to your terminal — install with one line, transcribe files or live mic, and pipe results to any LLM.

Source and Accuracy Notes

This section is MANDATORY. All links must be verified from actual source, not guessed.

What Is the Deepgram CLI?

The Deepgram CLI — distributed as dg (or deepctl, deepgram) — is the official command-line interface for Deepgram’s speech AI platform. It lets developers transcribe audio files, stream live speech from a microphone, synthesize text-to-speech, analyze text documents, and manage Deepgram projects directly from the terminal.

The CLI is built in Python and targets Python 3.10 or later. It is MIT-licensed and ships with 25-plus commands covering the full Deepgram API surface.

Key capabilities confirmed from the official CLI docs:

  • Speech-to-text (dg listen) — transcribe local audio files or remote URLs using Deepgram’s nova-3 model (default). Supports speaker diarization, smart formatting, topic detection, and summarization.
  • Live microphone transcription — real-time WebSocket streaming with interim results as you speak.
  • Text-to-speech (dg speak) — synthesize speech from text into audio files using multiple voice models.
  • Text intelligence (dg read) — analyze text documents for topics, sentiment, and summaries via Deepgram’s text API.
  • MCP server (dg mcp) — run the CLI as a Model Context Protocol server so Claude, Cursor, and other MCP clients can invoke its commands directly.
  • Full API access (dg api) — an escape-hatch for any Deepgram endpoint not yet covered by a dedicated subcommand.
  • AI agent detection — auto-detects Claude Code, Aider, OpenAI Codex, and other agent environments, disabling interactive prompts and routing status to stderr.

Installation

The official install methods from the project README:

macOS / Linux — curl (recommended):

curl -fsSL https://deepgram.com/install.sh | sh

macOS / Linux — Homebrew:

brew tap deepgram/tap
brew install deepgram

Homebrew automatically installs ffmpeg and portaudio as dependencies, so dg listen --mic, dg debug probe, and raw audio piping work out of the box.

Windows — PowerShell:

iwr https://deepgram.com/install.ps1 -useb | iex

Package managers:

pip install deepctl          # pip
uv tool install deepctl      # uv
pipx install deepctl        # pipx

Try without installing:

uvx deepctl --help
pipx run deepctl --help

Getting Started

Authenticate and run your first transcription:

dg login

# Transcribe a local file
dg listen recording.wav

# Transcribe a remote URL
dg listen https://example.com/audio.mp3

# Live microphone transcription
dg listen --mic --smart-format

# Text-to-speech synthesis
dg speak "Hello from Deepgram" -o hello.mp3

# Analyze a transcript with an LLM
dg listen meeting.mp3 | llm "summarize key decisions"

Deeper Analysis

AI Agent Awareness

The CLI automatically detects when it is running inside an AI coding agent (Claude Code, Aider, Codex, etc.). In agent context, it suppresses interactive prompts, routes status messages to stderr so stdout stays clean for piping, and defaults to JSON output. Pass --agent-friendly to any command to get a machine-readable JSON schema of its parameters — useful for building agent tooling on top of dg.

MCP Server Mode

Running dg mcp starts the CLI as a local MCP server. AI editor clients that support MCP (Claude Code, Cursor, etc.) can then invoke the full dg command surface as tools, with the CLI handling auth, output formatting, and error reporting automatically.

Shell Completions

The CLI ships completions for bash, zsh, and fish:

dg completion --shell bash >> ~/.bashrc
dg completion --shell zsh  >> ~/.zshrc
dg completion --shell fish > ~/.config/fish/completions/dg.fish

Output Formats

All commands support --output (-o) to switch between formats:

dg listen audio.wav -o json    # structured JSON (default when stdout is a pipe)
dg listen audio.wav -o yaml    # YAML
dg listen audio.wav -o table   # human-readable table
dg listen audio.wav -o csv     # CSV row per utterance

Practical Evaluation Checklist

  • One-line install verified: curl -fsSL https://deepgram.com/install.sh | sh
  • Authenticates via dg login and stores API key locally
  • Transcribes a local WAV/MP3 file with a single dg listen command
  • Live mic transcription streams interim results in real time
  • JSON output is clean (no status noise) when stdout is a pipe
  • dg mcp starts the server and exposes commands as MCP tools
  • Shell completions generate for the active shell
  • Uninstalls cleanly via pip uninstall deepctl or brew uninstall deepgram

Security Notes

  • API key is stored in the local user profile (~/.config/deepgram/ or equivalent), not in the repo or environment by default.
  • The CLI does not ship a server component — it is purely a client tool.
  • dg debug network checks TLS and WebSocket reachability to Deepgram endpoints before attempting a real transcription.

FAQ

Q: Does the CLI require a Deepgram account? A: Yes. dg login opens a browser for OAuth or accepts an API key directly. Some commands (like transcribing a file) require a funded Deepgram account, though the free tier includes a generous monthly allowance for new users.

Q: Can I use it offline? A: No — the CLI streams audio to Deepgram’s cloud API for transcription and synthesis. An internet connection is required.

Q: How does it compare to OpenAI’s Whisper CLI? A: Whisper is an offline model good for batch transcription. Deepgram’s nova-3 model is optimized for speed and cost in streaming scenarios, supports live microphone transcription with interim results, and adds features like speaker diarization and smart formatting out of the box.

Q: Does it work on Windows? A: Yes — install via PowerShell one-liner or pip install deepctl. Some features (like live mic) depend on audio device availability on the host system.

Conclusion

The Deepgram CLI (dg) is a well-documented, MIT-licensed developer tool that puts Deepgram’s speech AI platform at your fingertips without leaving the terminal. One-line install, full API surface via dg api, MCP server mode for AI editors, and clean UNIX-composable output make it a practical addition to any audio or transcription workflow.