Skip to content

v0.8.0

Release Date: 2026-02-14

New Cobra-based CLI with YAML configuration support for text-to-speech generation.

Highlights

  • New elevenlabs CLI with Cobra framework providing tts and ttsscript subcommands
  • YAML configuration files for reusable TTS settings with built-in presets

New Features

Cobra CLI Framework

The new elevenlabs CLI provides a unified interface for ElevenLabs text-to-speech operations:

# Install
go install github.com/agentplexus/go-elevenlabs/cmd/elevenlabs@latest

# View help
elevenlabs --help
elevenlabs tts --help
elevenlabs ttsscript --help

# Shell completion
elevenlabs completion bash > /etc/bash_completion.d/elevenlabs

tts Command

Generate speech from text files with full control over voice settings:

# Basic usage
elevenlabs tts -v <voice-id> input.txt

# With all options
elevenlabs tts \
  --voice IT8nQhZJj9jzRwmC46Ko \
  --model eleven_v3 \
  --format pcm_48000 \
  --stability 0.4 \
  --similarity 0.75 \
  --style 0.3 \
  --speed 0.95 \
  --output speech.wav \
  input.txt

Supported input formats:

  • Plain text
  • ElevenLabs-formatted text with SSML <break> tags
  • Emotion tags for v3 model: [calm], [excited], [firm], etc.
  • CAPITALIZED words for emphasis

YAML Configuration Files

Save and reuse TTS settings across projects:

# tts-config.yaml
voice_id: IT8nQhZJj9jzRwmC46Ko
model_id: eleven_v3
output_format: pcm_48000

voice_settings:
  stability: 0.4        # 0.0-1.0: lower = more expressive
  similarity_boost: 0.75 # 0.0-1.0: higher = closer to original
  style: 0.3            # 0.0-1.0: higher = more stylized
  speed: 0.95           # 0.25-4.0: speech rate multiplier
# Use config file
elevenlabs tts --config tts-config.yaml input.txt

# Save current settings to config
elevenlabs tts -v <voice-id> --preset oratory --save-config my-config.yaml input.txt

Built-in Presets

Three optimized presets for common use cases:

Preset Stability Style Speed Format Use Case
oratory 0.4 0.3 0.95 pcm_48000 Speeches, presentations
podcast 0.5 0.0 1.0 mp3_44100_128 Conversational content
audiobook 0.6 0.1 0.95 pcm_48000 Long-form narration
elevenlabs tts -v <voice-id> --preset oratory input.txt

Voice Settings Flags

Fine-tune voice characteristics from the command line:

Flag Range Description
--stability 0.0-1.0 Voice consistency (lower = more expressive)
--similarity 0.0-1.0 Adherence to original voice (higher = closer match)
--style 0.0-1.0 Style exaggeration (higher = more dramatic)
--speed 0.25-4.0 Speech rate (0.95 = gravitas, 1.1 = energetic)

Automatic Output Format Detection

Output file extension is automatically determined by format:

Format Prefix Extension
mp3_* .mp3
pcm_* .wav
opus_* .opus
ulaw_*, alaw_* .raw

Credit Estimation

Estimate API credits before generating audio with --estimate:

elevenlabs tts -v <voice-id> --estimate speech.txt

Output:

INFO credit estimate input=speech.txt words=453 characters=4600
     speed=0.95 estimated_duration="3m 10s" estimated_credits=3178

The estimator:

  • Counts words (excluding SSML tags and emotion markers)
  • Calculates duration based on ~150 WPM adjusted for speed setting
  • Estimates credits at ~1,000 credits per minute
  • Works without API key (no API call made)

Structured Logging

CLI commands use slog.Logger for structured, machine-parseable output:

2026/02/13 10:30:00 INFO generating speech input=input.txt output=input.wav voice=IT8n... model=eleven_v3
2026/02/13 10:30:05 INFO done bytes=1234567 file=input.wav

Migration from cmd/ttsscript

The standalone cmd/ttsscript has been migrated to elevenlabs ttsscript:

# Before
go run ./cmd/ttsscript -lang en script.json

# After
elevenlabs ttsscript -lang en script.json

All flags remain the same:

  • -l, --lang — Language code
  • -o, --output — Output directory
  • -m, --model — Model ID
  • --per-slide — Concatenate per-slide audio
  • --manifest — Generate manifest JSON
  • --dry-run — Preview without API calls

Installation

go get github.com/agentplexus/go-elevenlabs@v0.8.0

# Install CLI
go install github.com/agentplexus/go-elevenlabs/cmd/elevenlabs@v0.8.0

ttsconfig Package

The new ttsconfig subpackage provides reusable configuration types and utilities:

import "github.com/agentplexus/go-elevenlabs/ttsconfig"

// Load config from file
cfg, _ := ttsconfig.Load("config.yaml")

// Use preset
cfg := ttsconfig.Oratory()

// Estimate credits
est := ttsconfig.Estimate(text, 0.95)
fmt.Printf("Duration: %s, Credits: %d\n", est.Duration(), est.Credits)

// Convert to ElevenLabs settings
settings := cfg.VoiceSettings.ToElevenLabsSettings()

See TTS Config Package for full documentation.

Dependencies

  • Add github.com/spf13/cobra v1.10.2
  • Add gopkg.in/yaml.v3 v3.0.1