ElevenLabs API
Convert text to lifelike speech using ElevenLabs' advanced AI voices. Perfect for content creation, narration, and voice applications.
Overview
API Plugin's ElevenLabs integration provides easy access to state-of-the-art AI voice generation. Convert text to natural-sounding speech using a variety of voices and customization options.
Key benefits include:
- Lifelike AI voices
- Multiple voice options
- Voice customization
- High-quality audio
- Fast processing
- Simple integration
- MP3 format support
How to Setup
We assume you have signed up on API Plugin and are logged into the dashboard.
-
Get ElevenLabs API Key:
- Sign up at ElevenLabs (elevenlabs.io)
- Go to your Profile Settings
- Copy your API Key
-
Configure API:
- Go to API Plugin marketplace
- Select ElevenLabs API
- Input your API key
- Save configuration
Available Endpoints
- Text to Speech
POST /v1/{appId}/{token}/text-to-speech
Convert text to speech using specified voice and settings.
Request Body:
{
"text": "Hello, this is a test of the text to speech API.",
"voice_id": "21m00Tcm4TlvDq8ikWAM",
"model_id": "eleven_monolingual_v1",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
}
}
Response:
- Audio file (MP3 format)
- Content-Type: audio/mpeg
- Get Available Voices
GET /v1/{appId}/{token}/voices
Get list of available voices and their settings.
Response:
{
"voices": [
{
"voice_id": "21m00Tcm4TlvDq8ikWAM",
"name": "Rachel",
"category": "premade",
"description": "A warm and friendly female voice"
}
]
}
- Get Voice Settings
GET /v1/{appId}/{token}/voice-settings?voice_id=21m00Tcm4TlvDq8ikWAM
Get settings for a specific voice.
Response:
{
"stability": 0.5,
"similarity_boost": 0.75
}
Examples
- Basic Text to Speech
const response = await fetch('/v1/{appId}/{token}/text-to-speech', {
method: 'POST',
body: JSON.stringify({
text: 'Hello, this is a test message.',
voice_id: '21m00Tcm4TlvDq8ikWAM',
}),
});
// Handle audio response
const audioBlob = await response.blob();
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
- Customized Voice Settings
const response = await fetch('/v1/{appId}/{token}/text-to-speech', {
method: 'POST',
body: JSON.stringify({
text: 'This is a message with custom voice settings.',
voice_id: '21m00Tcm4TlvDq8ikWAM',
voice_settings: {
stability: 0.8,
similarity_boost: 0.6,
},
}),
});