Setup and customization
Complete configuration documentation for SpeakEasy, covering all available options for CLI, SDK, and global settings.
SpeakEasy uses a hierarchical configuration system with the following precedence (highest to lowest):
OPENAI_API_KEY
, etc.)~/.config/speakeasy/settings.json
)~/.config/speakeasy/settings.json
{
"providers": {
"openai": {
"enabled": true,
"voice": "nova",
"model": "tts-1",
"apiKey": "sk-..."
},
"elevenlabs": {
"enabled": true,
"voiceId": "EXAVITQu4vr4xnSDxMaL",
"modelId": "eleven_monolingual_v1",
"apiKey": "..."
},
"system": {
"enabled": true,
"voice": "Samantha"
},
"groq": {
"enabled": true,
"voice": "nova",
"model": "tts-1",
"apiKey": "gsk_..."
}
},
"defaults": {
"provider": "system",
"fallbackOrder": ["system", "openai", "elevenlabs", "groq"],
"rate": 180,
"volume": 0.7
},
"global": {
"tempDir": "/tmp",
"cleanup": true
},
"cache": {
"enabled": true,
"ttl": "7d",
"maxSize": "100mb",
"dir": "/tmp/speakeasy-cache"
}
}
Built-in voices - No API key required
{
"providers": {
"system": {
"enabled": true,
"voice": "Samantha"
}
}
}
Available voices:
Samantha
- Default female voiceAlex
- Male voiceVictoria
- Alternative female voiceDaniel
- British male voiceKaren
- Australian female voiceMoira
- Irish female voiceTessa
- South African female voicesay -v ?
to list all)API-based - Requires OpenAI API key
{
"providers": {
"openai": {
"enabled": true,
"voice": "nova",
"model": "tts-1",
"apiKey": "sk-..."
}
}
}
Configuration options:
voice
: alloy
, echo
, fable
, onyx
, nova
, shimmer
model
: tts-1
(fast), tts-1-hd
(high quality)apiKey
: OpenAI API key (or use OPENAI_API_KEY
env var)API-based - Requires ElevenLabs API key
{
"providers": {
"elevenlabs": {
"enabled": true,
"voiceId": "EXAVITQu4vr4xnSDxMaL",
"modelId": "eleven_monolingual_v1",
"apiKey": "..."
}
}
}
Configuration options:
voiceId
: Custom voice ID from ElevenLabsmodelId
: Model selection (see ElevenLabs docs)apiKey
: ElevenLabs API key (or use ELEVENLABS_API_KEY
env var)API-based - Requires Groq API key
{
"providers": {
"groq": {
"enabled": true,
"voice": "nova",
"model": "tts-1",
"apiKey": "gsk_..."
}
}
}
Configuration options:
voice
: Compatible with OpenAI voice namesmodel
: TTS model selectionapiKey
: Groq API key (or use GROQ_API_KEY
env var){
"defaults": {
"provider": "system",
"fallbackOrder": ["system", "openai", "elevenlabs", "groq"],
"rate": 180,
"volume": 0.7
}
}
Options:
provider
: Default provider to usefallbackOrder
: Provider fallback sequence on failurerate
: Default speech rate in WPM (80-400)volume
: Default volume level (0.0-1.0){
"global": {
"tempDir": "/tmp",
"cleanup": true
}
}
Options:
tempDir
: Directory for temporary audio filescleanup
: Auto-delete temporary files after playback{
"cache": {
"enabled": true,
"ttl": "7d",
"maxSize": "100mb",
"dir": "/tmp/speakeasy-cache"
}
}
Automatic expiration of cache entries:
{
"cache": {
"ttl": "7d" // 7 days
"ttl": "1h" // 1 hour
"ttl": "30m" // 30 minutes
"ttl": "1w" // 1 week
"ttl": "1M" // 1 month
"ttl": 86400 // 86400 seconds (1 day)
}
}
Cache size limits with automatic cleanup:
{
"cache": {
"maxSize": "100mb" // 100 megabytes
"maxSize": "1gb" // 1 gigabyte
"maxSize": "500mb" // 500 megabytes
"maxSize": 104857600 // 100MB in bytes
}
}
Custom cache location:
{
"cache": {
"dir": "/tmp/speakeasy-cache", // Default
"dir": "~/.cache/speakeasy", // User cache
"dir": "/var/cache/speakeasy", // System cache
"dir": "/custom/path/to/cache" // Custom path
}
}
# OpenAI API key
export OPENAI_API_KEY="sk-..."
# ElevenLabs API key
export ELEVENLABS_API_KEY="..."
# Groq API key
export GROQ_API_KEY="gsk_..."
# Override temp directory
export SPEAKEASY_TEMP_DIR="/custom/temp"
# Override cache directory
export SPEAKEASY_CACHE_DIR="/custom/cache"
# Enable debug mode
export SPEAKEASY_DEBUG="true"
import { SpeakEasy } from '@arach/speakeasy';
const speaker = new SpeakEasy({
// Provider selection
provider: 'openai',
// Voice configuration
openaiVoice: 'nova',
systemVoice: 'Samantha',
elevenlabsVoiceId: 'EXAVITQu4vr4xnSDxMaL',
// Speech parameters
rate: 200,
volume: 0.8,
// API keys (optional if env vars set)
apiKeys: {
openai: process.env.OPENAI_API_KEY,
elevenlabs: process.env.ELEVENLABS_API_KEY,
groq: process.env.GROQ_API_KEY
},
// System settings
tempDir: '/custom/temp',
debug: true,
// Cache configuration
cache: {
enabled: true,
ttl: '1d',
maxSize: '50mb',
dir: '/custom/cache'
}
});
// Individual speech with custom options
await speaker.speak('Hello world', {
priority: 'high',
interrupt: true,
cleanup: false
});
# Override provider and voice
speakeasy "Hello" --provider openai --voice nova
# Override rate and volume
speakeasy "Hello" --rate 250 --volume 0.5
# Enable cache for this request
speakeasy "Hello" --cache --provider elevenlabs
# Debug mode
speakeasy "Hello" --debug
# View current configuration
speakeasy --config
# Run configuration diagnostics
speakeasy --diagnose
# Health check with fixes
speakeasy --doctor
SpeakEasy automatically validates configuration on startup:
speakeasy --doctor
Checks performed:
import { SpeakEasy } from '@arach/speakeasy';
try {
const speaker = new SpeakEasy({
provider: 'openai',
// Missing API key - will validate at runtime
});
await speaker.speak('Test');
} catch (error) {
console.error('Configuration error:', error.message);
}
File: ~/.config/speakeasy/settings.json
{
"providers": {
"system": { "enabled": true, "voice": "Samantha" },
"openai": { "enabled": true, "voice": "nova" }
},
"defaults": {
"provider": "system",
"fallbackOrder": ["system", "openai"],
"rate": 180,
"volume": 0.7
},
"cache": { "enabled": true, "ttl": "1h" }
}
Environment: .env
OPENAI_API_KEY=sk-your-key-here
SPEAKEASY_DEBUG=true
{
"providers": {
"openai": {
"enabled": true,
"voice": "nova",
"model": "tts-1-hd"
},
"elevenlabs": {
"enabled": true,
"voiceId": "professional-voice-id"
},
"system": {
"enabled": true,
"voice": "Samantha"
}
},
"defaults": {
"provider": "openai",
"fallbackOrder": ["openai", "elevenlabs", "system"],
"rate": 180,
"volume": 0.8
},
"cache": {
"enabled": true,
"ttl": "7d",
"maxSize": "500mb",
"dir": "/var/cache/speakeasy"
}
}
{
"providers": {
"openai": {
"enabled": true,
"voice": "nova"
},
"system": {
"enabled": true,
"voice": "Samantha"
}
},
"defaults": {
"provider": "openai",
"fallbackOrder": ["openai", "system"],
"rate": 180,
"volume": 0.7
},
"cache": {
"enabled": true,
"ttl": "1d"
}
}
Configuration file not found
# Create directory and basic config
mkdir -p ~/.config/speakeasy
echo '{"providers":{"system":{"enabled":true}}}' > ~/.config/speakeasy/settings.json
Invalid JSON syntax
# Validate JSON
speakeasy --diagnose
# Fix: Use proper JSON formatting, escape quotes
API key not detected
# Check environment variables
env | grep -i api_key
# Check configuration file
speakeasy --config
# Set environment variable
export OPENAI_API_KEY="your-key-here"
Cache directory permissions
# Fix permissions
chmod 755 ~/.cache/speakeasy
# Or use different directory
export SPEAKEASY_CACHE_DIR="/tmp/speakeasy-cache"
# Enable debug mode
export SPEAKEASY_DEBUG=true
speakeasy "test configuration" --debug
# Detailed diagnostics
speakeasy --diagnose
# Health check
speakeasy --doctor
For provider-specific configuration details, see Providers Guide. For cache-specific settings, see Cache Guide.