Comprehensive ElevenLabs AI voice synthesis commands and workflows for text-to-speech and voice generation.
API Authentication
| Command | Description |
|---|
curl -H "xi-api-key: <api-key>" <endpoint> | API authentication |
export ELEVEN_API_KEY=<key> | Set environment variable |
elevenlabs auth login | Login to account |
elevenlabs auth logout | Logout from account |
elevenlabs auth status | Check authentication status |
Text-to-Speech API
| Endpoint | Description |
|---|
POST /v1/text-to-speech/{voice_id} | Generate speech |
POST /v1/text-to-speech/{voice_id}/stream | Stream speech |
GET /v1/voices | List available voices |
GET /v1/voices/{voice_id} | Get voice details |
POST /v1/voices/add | Add custom voice |
Voice Management
| Command | Description |
|---|
GET /v1/voices | List all voices |
GET /v1/voices/{voice_id} | Get voice information |
DELETE /v1/voices/{voice_id} | Delete custom voice |
POST /v1/voices/{voice_id}/edit | Edit voice settings |
GET /v1/voices/settings | Get voice settings |
Speech Generation
| Command | Description |
|---|
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM" -H "xi-api-key: <key>" -H "Content-Type: application/json" -d '{"text": "Hello world"}' | Basic speech generation |
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/stream" -H "xi-api-key: <key>" | Streaming speech |
Python SDK
| Command | Description |
|---|
pip install elevenlabs | Install Python SDK |
from elevenlabs import generate, play | Import SDK |
generate(text="Hello", voice="Bella") | Generate speech |
play(audio) | Play generated audio |
save(audio, "output.mp3") | Save audio file |
Voice Cloning
| Command | Description |
|---|
POST /v1/voices/add | Clone voice from samples |
POST /v1/voices/{voice_id}/samples | Add voice samples |
DELETE /v1/voices/{voice_id}/samples/{sample_id} | Delete voice sample |
GET /v1/voices/{voice_id}/samples | List voice samples |
Voice Settings
| Parameter | Description |
|---|
stability | Voice consistency (0.0-1.0) |
similarity_boost | Voice similarity (0.0-1.0) |
style | Speaking style (0.0-1.0) |
use_speaker_boost | Enhance speaker similarity |
| Format | Description |
|---|
mp3_44100_128 | MP3 44.1kHz 128kbps |
mp3_22050_32 | MP3 22.05kHz 32kbps |
pcm_16000 | PCM 16kHz |
pcm_22050 | PCM 22.05kHz |
pcm_24000 | PCM 24kHz |
pcm_44100 | PCM 44.1kHz |
Pre-built Voices
| Voice ID | Name | Description |
|---|
21m00Tcm4TlvDq8ikWAM | Rachel | American female |
AZnzlk1XvdvUeBnXmlld | Domi | American female |
EXAVITQu4vr4xnSDxMaL | Bella | American female |
ErXwobaYiN019PkySvjV | Antoni | American male |
MF3mGyEYCl7XYWbV9V6O | Elli | American female |
TxGEqnHWrfWFTfGW9XjX | Josh | American male |
VR6AewLTigWG4xSOukaG | Arnold | American male |
pNInz6obpgDQGcFmaJgB | Adam | American male |
Node.js SDK
| Command | Description |
|---|
npm install elevenlabs | Install Node.js SDK |
const { ElevenLabsAPI } = require('elevenlabs') | Import SDK |
const client = new ElevenLabsAPI({ apiKey: 'key' }) | Initialize client |
client.textToSpeech.generate() | Generate speech |
Streaming Audio
| Command | Description |
|---|
POST /v1/text-to-speech/{voice_id}/stream | Stream audio |
curl -X POST -H "xi-api-key: <key>" --data-raw '{"text":"Hello"}' --output audio.mp3 | Stream to file |
Voice Lab Features
| Feature | Description |
|---|
Voice Design | Create synthetic voices |
Voice Cloning | Clone existing voices |
Professional Cloning | High-quality voice cloning |
Voice Library | Browse voice collection |
API Rate Limits
| Plan | Characters/Month | Concurrent Requests |
|---|
Free | 10,000 | 2 |
Starter | 30,000 | 3 |
Creator | 100,000 | 5 |
Pro | 500,000 | 10 |
Scale | 2,000,000 | 25 |
Error Handling
| Error Code | Description |
|---|
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
422 | Unprocessable Entity |
429 | Too Many Requests |
500 | Internal Server Error |
Advanced Parameters
| Parameter | Description |
|---|
model_id | TTS model to use |
voice_settings | Voice configuration |
pronunciation_dictionary_locators | Custom pronunciations |
seed | Reproducible generation |
Webhook Configuration
| Command | Description |
|---|
POST /v1/webhooks | Create webhook |
GET /v1/webhooks | List webhooks |
DELETE /v1/webhooks/{webhook_id} | Delete webhook |
PUT /v1/webhooks/{webhook_id} | Update webhook |
Projects and Dubbing
| Command | Description |
|---|
POST /v1/projects | Create project |
GET /v1/projects | List projects |
POST /v1/dubbing | Create dubbing project |
GET /v1/dubbing/{dubbing_id} | Get dubbing status |
Usage Analytics
| Command | Description |
|---|
GET /v1/user/subscription | Get subscription info |
GET /v1/user | Get user information |
GET /v1/usage/character-stats | Get usage statistics |
| Command | Description |
|---|
elevenlabs --help | Show help |
elevenlabs tts --text "Hello" --voice Rachel | Generate speech |
elevenlabs voices list | List voices |
elevenlabs voices clone --name "MyVoice" | Clone voice |
Python Examples
| Code | Description |
|---|
audio = generate(text="Hello", voice="Bella", model="eleven_monolingual_v1") | Basic generation |
play(audio) | Play audio |
save(audio, "hello.mp3") | Save to file |
JavaScript Examples
| Code | Description |
|---|
const audio = await elevenlabs.generate({ text: "Hello", voice: "Rachel" }) | Generate audio |
fs.writeFileSync("audio.mp3", audio) | Save to file |
Voice Cloning Process
| Step | Description |
|---|
1. Upload samples | Provide voice samples |
2. Train model | AI learns voice patterns |
3. Test generation | Verify voice quality |
4. Fine-tune settings | Adjust parameters |
5. Deploy voice | Use in production |
Best Practices
| Practice | Description |
|---|
Clear audio samples | High-quality recordings |
Diverse samples | Various emotions/styles |
Consistent speaker | Same person throughout |
Proper length | 1-5 minutes total |
Good microphone | Professional recording |
Integration Examples
| Platform | Integration |
|---|
Discord Bot | Voice message generation |
Podcast | Automated narration |
E-learning | Course voice-overs |
Gaming | Character voices |
Accessibility | Text-to-speech for visually impaired |
Troubleshooting
| Issue | Solution |
|---|
Poor voice quality | Improve sample quality |
Rate limit exceeded | Upgrade plan or wait |
Authentication failed | Check API key |
Voice not found | Verify voice ID |
Audio distortion | Adjust voice settings |
Environment Variables
| Variable | Description |
|---|
ELEVEN_API_KEY | API authentication key |
ELEVEN_API_URL | API base URL |
ELEVEN_TIMEOUT | Request timeout |
Configuration Files
| File | Description |
|---|
.elevenlabs.json | Configuration file |
voices.json | Voice definitions |
settings.json | Default settings |
Monitoring and Analytics
| Metric | Description |
|---|
Characters used | Monthly usage |
API calls | Request count |
Voice generations | Audio created |
Error rate | Failed requests |