CLI Authentication

Authenticate the Deepgram CLI with your API key.

Interactive Login

The simplest way to authenticate:

$dg login

This opens your browser to the Deepgram Console where you can authorize the CLI. Once authorized, your API key is stored securely in ~/.config/deepgram/credentials.

API Key Flag

For CI/CD environments or scripted usage, pass your API key directly:

$dg --api-key YOUR_API_KEY listen audio.mp3

Environment Variable

Set your API key as an environment variable:

$export DEEPGRAM_API_KEY=YOUR_API_KEY
$dg listen audio.mp3

Named Profiles

Use multiple API keys with named profiles:

$dg login --profile production
$dg login --profile development
$
$# Use a specific profile
$dg --profile production listen audio.mp3

Profiles store credentials in ~/.config/deepgram/profiles/<name>/credentials.

Check Auth Status

$dg whoami

Output:

Logged in as: you@company.com
API Key: sk_live_...1234
Source: ~/.config/deepgram/credentials

CI/CD Usage

For CI/CD pipelines, use the --api-key flag or environment variable:

1# Example GitHub Actions
2- name: Transcribe audio
3 env:
4 DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }}
5 run: dg listen audio.mp3 -o json > transcript.json