Documentation Index
Fetch the complete documentation index at: https://elevenlabs8.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Convert Text to Speech
Convert text to speech using TTSLab’s advanced AI models.
curl -X POST "https://api.elevenlabs8.com/api/tts/audio-generate/" \
-H "X-API-KEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
{
"text": "Hello, this is a test message.",
"voice_id": "JBFqnCBsd6RMkjVDRZzb"
},
{
"text": "Hello, this is a test message.",
"voice_id": "JBFqnCBsd6RMkjVDRZzb"
}
],
"model_id": "eleven_v3"
}'
Request Parameters
v3 Models
| Parameter | Type | Required | Description |
|---|
inputs.text | string | Yes | Text to convert to speech |
inputs.voice_id | string | Yes | Voice ID to use |
model_id | string | Yes | Model ID (e.g., “eleven_v3”) |
v1/v2 Models
| Parameter | Type | Required | Description |
|---|
text | string | Yes | Text to convert to speech |
voice_id | string | Yes | Voice ID to use |
model_id | string | Yes | Model ID (e.g., “eleven_flash_v2_5”) |
config | object | No | Voice configuration settings |
Config Parameters (v1/v2 only)
| Parameter | Type | Range | Description |
|---|
stability | float | 0.0 - 1.0 | Controls voice consistency |
similarity_boost | float | 0.0 - 1.0 | Controls voice similarity to original |
style | float | 0.0 - 1.0 | Controls speaking style |
use_speaker_boost | boolean | - | Enhances speaker clarity |
Response
{
"success": true,
"data": {
"id": "history_id_123",
"user": {
"fullname": "John Doe",
"avatar": "https://api.elevenlabs8.com/media/avatars/john.jpg"
},
"history_id": "unique_history_id",
"prompt": "Hello, this is a test message.",
"model": "eleven_v3",
"voice": "Rachel",
"config": {
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0.0,
"use_speaker_boost": true
},
"credits_used": 1,
"status": "completed",
"shared_url": "https://app.elevenlabs8.com/share/audio_id",
"created_at": "2024-01-01T12:00:00Z",
"audio_url": "https://api.elevenlabs8.com/media/audio/output.mp3"
},
"message": "Audio generated successfully"
}
Downloading the Audio
To get the actual audio file, make a GET request to the audio_url:
# Download the audio file
audio_response = requests.get(response.json()["data"]["audio_url"])
with open("output.mp3", "wb") as f:
f.write(audio_response.content)
Error Responses
{
"success": false,
"error": {
"code": "INVALID_VOICE_ID",
"message": "Voice ID not found"
}
}
Common Error Codes
| Code | Description |
|---|
INVALID_API_KEY | Invalid or missing API key |
INVALID_VOICE_ID | Voice ID not found |
INVALID_MODEL_ID | Model ID not found |
TEXT_TOO_LONG | Text exceeds maximum length |
INSUFFICIENT_CREDITS | Not enough credits |
RATE_LIMIT_EXCEEDED | Rate limit exceeded |