Text-to-Speech Commands

Synthesize speech from text with Deepgram Flux TTS and Aura models using the dg CLI.

Basic Synthesis

dg speak "Hello from Deepgram" -o hello.wav

Save to File

dg speak "Hello from Deepgram" -o hello.wav
dg speak "Hello" -m aura-2-luna-en --encoding mp3 -o hello.mp3

Pipe to Speaker

echo "Latest headlines" | dg speak | ffplay -nodisp -autoexit -

Options

Model Selection

dg speak "Hello" --model flux-alexis-en -o hello.wav
dg speak "Hello" -m aura-2-luna-en --encoding mp3 -o hello.mp3

dg speak defaults to flux-alexis-en. Flux TTS uses the Speak v2 WebSocket API and streams raw audio; when writing the default linear16 output to a file, the CLI wraps it in a WAV container. Use an aura-* model for the Speak v1 REST API.

List available TTS models:

dg models --type tts

Output Format

-o or --output sets the output file path. To select audio encoding, use --encoding; Aura models also support --container.

dg speak "Hello" -o hello.wav
dg speak "Hello" -m aura-2-asteria-en --encoding mp3 -o hello.mp3
dg speak "Hello" -m aura-2-asteria-en --encoding linear16 --container wav -o hello.wav

Streaming

Flux TTS streams audio by default. Pipe the WAV stream to a player instead of writing it to a file:

dg speak "Hello" | ffplay -loglevel error -nodisp -autoexit -

Flux models also support --speed from 0.85 to 1.15 in 0.05 increments and beta --expressivity from -2 to 2:

dg speak "A little slower" --speed 0.9 --expressivity 1 -o slow.wav

Example Workflows

Batch Synthesis

# Synthesize multiple phrases
for text in "Hello" "Goodbye" "Thank you"; do
dg speak "$text" -o "$text.wav"
done

Language Selection

Choose a model for the required language. The language is part of the model identifier; dg speak does not have a --language option.

dg speak "Hola" -m aura-2-selena-es --encoding mp3 -o hola.mp3