Configuration
Babulus uses a YAML configuration file to store API keys, provider settings, and global options.
Configuration File Location
Babulus searches for config.yml in the following locations (in order):
- Project directory:
./.babulus/config.yml - Home directory:
~/.babulus/config.yml - Environment variable: Path specified in
BABULUS_PATH - CLI flag:
--config /path/to/config.yml
The first configuration file found will be used.
Creating Your Configuration
Copy the example configuration:
cp .babulus/config.yml.example .babulus/config.ymlAdd your API keys to
.babulus/config.ymlImportant: The
.babulus/config.ymlfile is in.gitignoreto protect your API keys. Never commit this file to version control.
Configuration Format
# TTS Provider Configuration
providers:
# OpenAI TTS (recommended for development)
openai:
api_key: "sk-..."
model: "gpt-4o-mini-tts"
voice: "alloy"
# ElevenLabs (recommended for production)
elevenlabs:
api_key: "..."
voice_id: "..."
model_id: "eleven_multilingual_v2"
# Azure Speech (alternative)
azure_speech:
api_key: "..."
region: "eastus"
voice: "en-US-JennyNeural"
# Environment-specific defaults
environments:
development:
default_provider: "openai"
production:
default_provider: "elevenlabs"
Provider Selection
In Your DSL Code
You can specify the provider in your video definition:
export default defineVideo((video) => {
video.composition("My Video", (composition) => {
// Use OpenAI for this video
composition.voiceover({ provider: "openai" });
// Or use ElevenLabs
composition.voiceover({
provider: "elevenlabs",
voice: "specific-voice-id"
});
});
});
Via CLI Flags
Override the provider when generating:
# Use OpenAI
npx babulus generate video.babulus.xml --provider openai
# Use ElevenLabs
npx babulus generate video.babulus.xml --provider elevenlabs
# Use development environment defaults
npx babulus generate video.babulus.xml --env development
Via Environment Variables
API keys can also be provided via environment variables:
export OPENAI_API_KEY="sk-..."
export ELEVENLABS_API_KEY="..."
export AZURE_SPEECH_KEY="..."
export AZURE_SPEECH_REGION="eastus"
npx babulus generate video.babulus.xml --provider openai
Environment variables take precedence over the configuration file.
TTS Providers
OpenAI TTS
Best for: Development, cost-effective, fast generation
Pricing: $0.015 per 1000 characters ($0.01 per minute of audio)
Models:
gpt-4o-mini-tts- Best quality, latest model (recommended)gpt-4o-audio-preview- Advanced audio with real-time capabilitiestts-1- Fast, lower latencytts-1-hd- Higher quality
Voices: alloy, echo, fable, onyx, nova, shimmer
Setup:
- Get API key from https://platform.openai.com/api-keys
- Add to
.babulus/config.yml:providers: openai: api_key: "sk-..." model: "gpt-4o-mini-tts" voice: "alloy"
ElevenLabs
Best for: Production, highest quality, voice cloning
Pricing: Varies by plan, ~$0.30 per 1000 characters
Models:
eleven_multilingual_v2- Best quality, 29 languages (recommended)eleven_turbo_v2- Fastest, lower latencyeleven_monolingual_v1- English only
Setup:
- Get API key from https://elevenlabs.io/app/settings/api-keys
- Choose or create a voice at https://elevenlabs.io/app/voices
- Add to
.babulus/config.yml:providers: elevenlabs: api_key: "..." voice_id: "..." model_id: "eleven_multilingual_v2"
Azure Speech
Best for: Enterprise, Microsoft ecosystem integration
Pricing: ~$0.016 per 1000 characters
Setup:
- Create Azure Speech resource in Azure Portal
- Get API key and region
- Choose voice from https://learn.microsoft.com/azure/ai-services/speech-service/language-support
- Add to
.babulus/config.yml:providers: azure_speech: api_key: "..." region: "eastus" voice: "en-US-JennyNeural"
Dry-Run Mode
For testing without API calls, use the dry-run provider:
composition.voiceover({ provider: "dry-run" });
This generates silent audio files with correct timing but makes no API calls and incurs no cost.
Configuration via Environment Variables
You can also set configuration via environment variables instead of the config file:
# Required for each provider
export OPENAI_API_KEY="sk-..."
export ELEVENLABS_API_KEY="..."
export AZURE_SPEECH_KEY="..."
export AZURE_SPEECH_REGION="eastus"
# Optional: specify config file location
export BABULUS_PATH="/path/to/config.yml"
Troubleshooting
"No API key" or silent audio
Problem: Generated audio is silent or you see "dry-run" provider in logs.
Solutions:
- Verify
.babulus/config.ymlexists and contains your API keys - Check that API keys don't start with "test-" (these trigger dry-run mode)
- Ensure you're using
--provider openaior--provider elevenlabsflag - Verify environment variables are set if not using config file
"Config not found"
Problem: Babulus can't find your configuration file.
Solutions:
- Verify file location:
./.babulus/config.ymlor~/.babulus/config.yml - Check file permissions (must be readable)
- Use
--config /path/to/config.ymlto specify explicitly - Set
BABULUS_PATHenvironment variable
"Invalid config"
Problem: Configuration file has syntax errors.
Solutions:
- Verify YAML syntax (use a YAML validator)
- Ensure proper indentation (2 spaces, not tabs)
- Check that all strings with special characters are quoted
- Validate against the example:
.babulus/config.yml.example
Security Best Practices
- Never commit config.yml: The file is in
.gitignoreby default - Use environment variables in CI/CD: Don't store API keys in code
- Rotate keys regularly: Especially for shared/team accounts
- Use separate keys per environment: Different keys for dev/staging/prod
- Restrict key permissions: Use read-only keys when possible