ElevenLabs-compatible API
Text to speech, speech to text, voice changer, sound effects and music in the ElevenLabs API and OpenAI formats: the same SDK, a different base URL.
The gateway accepts requests in the ElevenLabs API format: the official ElevenLabs SDKs (Python, Node) and any client that can change its base URL work without code changes. Text to speech, speech to text, voice changer, sound effects, music, the voice list and the model list are available; speech and transcription also work on OpenAI-compatible paths.
Base URL and key
The base URL for the ElevenLabs SDK has no /v1; the SDK adds the path itself:
https://llmbox.ccPass the key in the xi-api-key header, as ElevenLabs itself does;
Authorization: Bearer and x-api-key are accepted too. The examples below use
the $LLMBOX_API_KEY placeholder — replace it with your own key. More on keys:
Keys and authentication.
Text to speech
POST /v1/text-to-speech/{voice_id} returns the finished file in one piece,
and POST /v1/text-to-speech/{voice_id}/stream streams the audio as it is
produced. The request body is JSON:
curl -X POST "https://llmbox.cc/v1/text-to-speech/VOICE_ID?output_format=mp3_44100_128" \
-H "xi-api-key: $LLMBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello! This is a speech test.",
"model_id": "eleven_multilingual_v2",
"voice_settings": {"stability": 0.5, "similarity_boost": 0.75}
}' \
-o speech.mp3
Take VOICE_ID from the voice list. A voice_id may contain
letters, digits, _ and -, up to 64 characters.
text— required, a non-empty string of at most 50 000 characters (otherwise400 text_too_long).model_id— optional,eleven_multilingual_v2by default. The model must be in the catalog and be a speech model, otherwise404 model_not_found.output_format(query) — audio format,mp3_44100_128by default. Allowed:mp3_*(mp3_22050_32,mp3_24000_48,mp3_44100_32,mp3_44100_64,mp3_44100_96,mp3_44100_128,mp3_44100_192),opus_48000_*(32,64,96,128,192),pcm_*(8000,16000,22050,24000,32000,44100,48000),wav_*(the same rates),ulaw_8000,alaw_8000andm4a_aac_44100_128. Any other value gives400 invalid_output_format.optimize_streaming_latency(query) — an integer from 0 to 4.voice_settings— an object withstability,similarity_boost,style,use_speaker_boost,speed.- Other supported body fields:
language_code,seed,previous_text,next_text,apply_text_normalization,apply_language_text_normalization,audio_effects,use_pvc_as_ivc.
The response is audio in the chosen format. Of the headers you get
content-type, x-request-id and x-ratelimit-*.
The same request through the ElevenLabs SDK (setting up the SDK is covered in ElevenLabs SDK):
from elevenlabs.client import ElevenLabs
client = ElevenLabs(base_url="https://llmbox.cc", api_key="$LLMBOX_API_KEY")
audio = client.text_to_speech.convert(
voice_id="VOICE_ID",
text="Hello! This is a speech test.",
model_id="eleven_multilingual_v2",
output_format="mp3_44100_128",
)
with open("speech.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
Billing is per character of the text field at the model's price per 1 000
characters. The price is known up front: the reserve equals the charge. A
request rejected before synthesis (a body error, a bad key, an insufficient
balance) costs nothing.
Voices
Voices are read-only; the requests are free and do not touch your balance:
| Endpoint | Returns |
|---|---|
GET/v1/voices | The voice list |
GET/v2/voices | A list with search and pagination |
GET/v1/voices/{voice_id} | One voice |
GET/v1/shared-voices | The shared voice library |
GET/v1/voices/settings/default | Default voice settings |
These query parameters work: search, category, voice_type, page_size,
page, next_page_token, include_total_count, sort, sort_direction,
gender, age, accent, language, locale, use_cases, voice_ids,
show_legacy; the rest are dropped.
curl "https://llmbox.cc/v2/voices?page_size=20&search=anna" \
-H "xi-api-key: $LLMBOX_API_KEY"
The response keeps the fields describing the voice itself: voice_id, name,
category, labels, description, preview_url, settings,
verified_languages, language, model_id, accent, locale, high_quality_base_model_ids, gender,
age, use_case, and for lists voices, has_more, total_count,
next_page_token. Everything else (account, plan and sample details) is not
passed on. Responses are cached for up to a minute, so changes to the voice list
appear with a short delay.
Speech to text
POST /v1/speech-to-text takes audio or video and returns text. The request is
multipart/form-data:
curl -X POST "https://llmbox.cc/v1/speech-to-text" \
-H "xi-api-key: $LLMBOX_API_KEY" \
-F model_id=scribe_v2 \
-F file=@input.mp3 \
-F language_code=en \
-F diarize=true
model_id– required, for examplescribe_v2.file– a required file upload of up to 90 MiB. URL inputs (source_url,cloud_storage_url) are not supported yet –400 invalid_request; upload the file instead.- Optional:
language_code,diarize,num_speakers,timestamps_granularity,tag_audio_events,temperature,seedand other recognition fields without paid add-ons.
The response is JSON: text, language_code, words (words with timestamps
and, with diarize, speakers) and audio_duration_secs.
Billing – per second of input audio, rounded up; the duration comes from
audio_duration_secs in the response. A request rejected before recognition
costs nothing.
from elevenlabs.client import ElevenLabs
client = ElevenLabs(base_url="https://llmbox.cc", api_key="$LLMBOX_API_KEY")
with open("input.mp3", "rb") as f:
result = client.speech_to_text.convert(model_id="scribe_v2", file=f, language_code="en")
print(result.text)
Voice changer
POST /v1/speech-to-speech/{voice_id} and POST /v1/speech-to-speech/{voice_id}/stream
turn a recording in one voice into speech in the chosen voice. The request is
multipart/form-data, the response is audio (/stream delivers it as a stream):
curl -X POST "https://llmbox.cc/v1/speech-to-speech/VOICE_ID?output_format=mp3_44100_128" \
-H "xi-api-key: $LLMBOX_API_KEY" \
-F model_id=eleven_multilingual_sts_v2 \
-F audio=@input.mp3 \
--output output.mp3
audio– required file with the source recording.model_id–eleven_multilingual_sts_v2by default.voice_settings– a JSON string with voice settings.remove_background_noiseandfile_format– as in ElevenLabs.output_format(query) –mp3_44100_128by default;m4a_aac_44100_128is not allowed here (400 invalid_output_format).
Billing – per second of output audio, rounded up.
Sound effects
POST /v1/sound-generation creates a sound from a text description. The body is
JSON:
curl -X POST "https://llmbox.cc/v1/sound-generation" \
-H "xi-api-key: $LLMBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Rain on a tin roof", "duration_seconds": 5, "model_id": "eleven_text_to_sound_v2"}' \
--output sound.mp3
text– required description of the sound.duration_seconds– from 0.5 to 30; outside the range –400 invalid_duration.prompt_influence– from 0 to 1;loop– loop the sound.model_id–eleven_text_to_sound_v2by default.
Billing – per second of output audio, rounded up, but no more than the
requested duration (without duration_seconds the ceiling is 30 seconds).
Music
POST /v1/music returns a finished track, POST /v1/music/stream a stream. The
body is JSON and needs exactly one of prompt or composition_plan:
curl -X POST "https://llmbox.cc/v1/music" \
-H "xi-api-key: $LLMBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "Calm piano, slow tempo", "music_length_ms": 10000, "model_id": "music_v1"}' \
--output music.mp3
promptorcomposition_plan– a description of the track or a ready plan of sections; both or neither –400 invalid_request.music_length_ms– from 3,000 to 600,000, allowed only together withprompt; outside the range –400 invalid_duration.model_id–music_v1by default;seed,force_instrumental.
Billing – per second of output audio, rounded up, but no more than the
requested length: for prompt that is music_length_ms, for a plan the sum of
section durations with respect_sections_durations: true, otherwise a ceiling
of 600 seconds.
OpenAI-compatible paths
Speech and transcription are also available in the OpenAI format: the official
OpenAI SDKs and any client that can change its base URL work. The address here
includes /v1, the key goes in Authorization: Bearer; xi-api-key is
accepted too.
POST /v1/audio/speech – text to speech. JSON: model, input, voice,
response_format (mp3, opus, wav, pcm) and speed (0.7–1.2). The
OpenAI voices alloy, ash, ballad, coral, echo, fable, nova,
onyx, sage, shimmer, verse map to ElevenLabs voices; any other voice
value is used as an ElevenLabs voice_id. aac and flac -
400 unsupported_value; instructions is ignored. Billed per character of
input.
POST /v1/audio/transcriptions – transcription, multipart/form-data: file,
model, language, response_format (json, text, verbose_json). srt
and vtt – 400 unsupported_value, as are stream=true and URL inputs
instead of a file (source_url, cloud_storage_url); prompt is ignored.
Billed per second of audio, rounded up, like speech to text above.
from openai import OpenAI
client = OpenAI(base_url="https://llmbox.cc/v1", api_key="$LLMBOX_API_KEY")
speech = client.audio.speech.create(
model="eleven_multilingual_v2", voice="alloy", input="Hello!", response_format="mp3",
)
speech.write_to_file("speech.mp3")
with open("input.mp3", "rb") as f:
text = client.audio.transcriptions.create(model="scribe_v2", file=f, language="en")
print(text.text)
Models
GET /v1/models with the xi-api-key header (and no Authorization) returns
an array of audio models in the ElevenLabs format: model_id, name,
can_do_text_to_speech, can_do_voice_conversion, languages. With
Authorization: Bearer the endpoint returns the regular gateway catalog — see
Model catalog.
A catalog model id is elevenlabs/<model_id>, where model_id is the
ElevenLabs id unchanged, for example elevenlabs/eleven_v3. The gateway
accepts both the full id and the bare ElevenLabs id (eleven_v3), so code
written for the ElevenLabs SDK works as is. The ElevenLabs-format list returns
model_id without the prefix.
curl https://llmbox.cc/v1/models -H "xi-api-key: $LLMBOX_API_KEY"
What is stripped
The gateway passes only supported fields to the provider; the rest are not passed on, and the request runs without them:
- In a speech body,
pronunciation_dictionary_locators,previous_request_idsandnext_request_idsare always dropped: they refer to resources of the provider's account. A top-levelspeedis dropped too — speed is set insidevoice_settings. - In a speech query only
output_formatandoptimize_streaming_latencyapply;enable_logging,tokenand the like are dropped. - In a voices query only the parameters listed in Voices apply.
- Provider headers (request ids, character cost, region and so on) never reach you.
- In speech to text the paid add-ons are dropped:
keyterms,transcript_edit,detect_speaker_roles,use_multi_channel,multichannel_output_style,entity_detection,entity_redaction*,webhook*,additional_formats,use_speaker_library. - In music
finetune_id,store_for_inpaintingandsign_with_c2paare dropped, and insidecomposition_planso aresource_fromandconditioning_ref.
Errors
Errors of the audio endpoints come in the ElevenLabs format:
{"detail": {"type": "invalid_request", "code": "text_too_long", "status": "text_too_long", "message": "The text must not exceed 50000 characters.", "request_id": "req_..."}}
request_id matches the x-request-id header — quote it when contacting
support. param is sometimes added — the name of the offending field. The texts
do not reveal the provider or its plan.
| Status | Code | When |
|---|---|---|
| 400 | invalid_voice_id | voice_id has invalid characters or is longer than 64 |
| 400 | invalid_request | empty text, a wrong type of model_id, voice_settings or optimize_streaming_latency; no file or a URL instead of it in speech to text |
| 400 | text_too_long | text is longer than 50 000 characters |
| 400 | invalid_output_format | output_format is not in the list |
| 400 | invalid_duration | duration_seconds or music_length_ms is outside the allowed range |
| 400 | invalid_content | an empty or unsuitable file |
| 400 | unsupported_value | on the OpenAI paths: a response format or value the gateway does not support (aac, flac, srt, vtt, stream=true, URL inputs) |
| 401 | invalid_api_key | the key is missing or invalid |
| 402 | insufficient_quota | the free remainder doesn't cover the request's reserve — see Limits |
| 403 | spend_limit_exceeded | the key's spend limit is reached |
| 404 | model_not_found | the model does not exist, is disabled, is not available to you, or does not fit this endpoint |
| 404 | not_found | a path the gateway does not have |
| 405 | method_not_allowed | the path exists but the method is wrong (for example GET on speech); the response has Allow: POST |
| 413 | request_too_large | the request body is too large |
| 429 | rate_limit_exceeded | request limit exceeded; see Retry-After |
| 502 | upstream_unavailable | providers are temporarily unavailable |
| 503 | service_unavailable | no provider is available or the database is unavailable; see Retry-After |
| 503 | server_restarting | the server is restarting during the request — retry; no charge |
| 504 | upstream_timeout | the provider did not answer in time, no charge |
More on limits: Limits.
What is next
Dubbing is planned for a later release. For now POST /v1/dubbing answers
404 not_found.