ElevenLabs AI voice generation API via curl. Use this skill to convert text to speech with realistic AI voices.
/plugin marketplace add vm0-ai/api0/plugin install api0@api0This skill inherits all available tools. When active, it can use any tool Claude has access to.
Use the ElevenLabs API via direct curl calls to generate realistic AI speech from text.
Official docs:
https://elevenlabs.io/docs/api-reference
Use this skill when you need to:
ELEVENLABS_API_KEYexport ELEVENLABS_API_KEY="your-api-key"
xi-api-key headerImportant: When using
$VARin a command that pipes to another command, wrap the command containing$VARinbash -c '...'. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq .
All examples below assume you have ELEVENLABS_API_KEY set.
The base URL for the ElevenLabs API is:
https://api.elevenlabs.io/v1Get all voices available to your account:
bash -c 'curl -s -X GET "https://api.elevenlabs.io/v1/voices" --header "xi-api-key: ${ELEVENLABS_API_KEY}"' | jq '.voices[] | {voice_id, name, category}
This returns voice IDs needed for text-to-speech. Common voice categories:
premade: ElevenLabs default voicescloned: Your cloned voicesgenerated: AI-designed voicesGet detailed information about a specific voice:
VOICE_ID="21m00Tcm4TlvDq8ikWAM"
bash -c 'curl -s -X GET "https://api.elevenlabs.io/v1/voices/${VOICE_ID}" --header "xi-api-key: ${ELEVENLABS_API_KEY}"' | jq .
Get all available TTS models:
bash -c 'curl -s -X GET "https://api.elevenlabs.io/v1/models" --header "xi-api-key: ${ELEVENLABS_API_KEY}"' | jq '.[] | {model_id, name, can_do_text_to_speech}
Common models:
eleven_multilingual_v2: Best quality, supports 29 languageseleven_flash_v2_5: Low latency, good for real-timeeleven_v3: Latest model (alpha)Convert text to speech and save as MP3:
VOICE_ID="21m00Tcm4TlvDq8ikWAM"
curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/${VOICE_ID}" --header "xi-api-key: ${ELEVENLABS_API_KEY}" --header "Content-Type: application/json" --header "Accept: audio/mpeg" -d '{
"text": "Hello! This is a test of the ElevenLabs text to speech API.",
"model_id": "eleven_multilingual_v2",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
}
}' --output speech.mp3
Voice settings:
stability (0.0-1.0): Higher = more consistent, lower = more expressivesimilarity_boost (0.0-1.0): Higher = closer to original voiceStream audio for real-time playback:
VOICE_ID="21m00Tcm4TlvDq8ikWAM"
curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/${VOICE_ID}/stream" --header "xi-api-key: ${ELEVENLABS_API_KEY}" --header "Content-Type: application/json" --header "Accept: audio/mpeg" -d '{
"text": "This audio is being streamed in real-time.",
"model_id": "eleven_flash_v2_5"
}' --output streamed.mp3
Check your usage and character limits:
bash -c 'curl -s -X GET "https://api.elevenlabs.io/v1/user/subscription" --header "xi-api-key: ${ELEVENLABS_API_KEY}"' | jq '{character_count, character_limit, tier}
You can specify different output formats via the output_format query parameter:
curl -s -X POST "https://api.elevenlabs.io/v1/text-to-speech/${VOICE_ID}?output_format=pcm_16000" --header "xi-api-key: ${ELEVENLABS_API_KEY}" --header "Content-Type: application/json" -d '{"text": "Hello world", "model_id": "eleven_multilingual_v2"}' --output speech.pcm
Available formats:
mp3_44100_192 (default): MP3 at 44.1kHz, 192kbpsmp3_44100_128: MP3 at 44.1kHz, 128kbpspcm_16000: PCM at 16kHzpcm_22050: PCM at 22.05kHzpcm_24000: PCM at 24kHzeleven_flash_v2_5 for low latency, eleven_multilingual_v2 for best quality