Contents
Text to speech (TTS) guide
Text to speech (TTS) guide
POST /v1/audio/speech is OpenAI-compatible: send JSON, get the audio file back as binary. Speech models include the ElevenLabs family (elevenlabs/eleven-v4, eleven-v4-turbo, eleven-v3, eleven-v3-conversational, eleven-multilingual-v2, eleven-flash-v2.5, eleven-flash-v2, eleven-turbo-v2.5, eleven-turbo-v2). The live list is GET /v1/models?output_modalities=speech. GET /v1/models returns text models only by default, so add ?output_modalities=speech (or all) to list them.
/v1/audio/speechParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Speech model id, e.g. elevenlabs/eleven-flash-v2.5. |
| input | string | Yes | Text to synthesize: up to 4,096 characters per request (10,000 for elevenlabs/eleven-v4 and eleven-v4-turbo). Split longer text into several requests. |
| voice | string | Yes | Voice to use. Its format depends on the model — see Voice rules below. |
| response_format | string | No | mp3 (default) or pcm. opus, aac, flac and wav are accepted by the API but currently rejected by ElevenLabs models with 400. |
| speed | number | No | Speaking speed from 0.25 to 4.0. Not every model applies it. |
| instructions | string | No | Style instructions for the voice. Not every model applies it. |
| stability | number | No | Voice stability, 0–1 (default 0.5). Lower is more expressive, higher is more even. Takes effect on elevenlabs/* models when the request is served by our direct voice route; the X-Voice-Settings response header says applied or ignored. |
| similarity_boost | number | No | Similarity to the original voice, 0–1 (default 0.75). Not used by Eleven v3. |
| style | number | No | Style exaggeration, 0–1 (default 0). Above 0 adds latency. Not used by Eleven v4. |
| use_speaker_boost | boolean | No | Boosts similarity to the original speaker (default true); adds a little latency. |
| clone_strength | number | No | Clone strength, 0–1 (0 is recommended for most voices). Only for your own professional clone voices (voice_…) trained for Eleven v4. |
| language_code | string | No | Two-letter lowercase language code (ISO 639-1) such as ar, ja or en, to fix the spoken language. Not used by multilingual-v2 models. |
| audio_effects | object | No | Optional audio-effects object: filter_preset_id (e.g. phone, old_radio), environment_id (reverb space, e.g. small_room, hall), background_noise_id (e.g. cafe), distance (0–1), send_level (reverb amount, 0–1) and pan (−1…1). IDs use lowercase letters, digits and underscores; no extra charge. Reverb or a non-zero pan produces stereo audio and cannot be combined with pcm output. |
The seven voice settings above are all optional; leaving them out changes nothing. A value out of range returns 400 and is neither sent nor billed. The response header X-Voice-Settings tells you whether your settings were used: applied = used; ignored = a fallback route answered, so your settings were not used (the audio is still produced); no header = you sent no voice settings. For example, stability 0 reads with more expression, stability 1 more evenly.
Voice rules
ElevenLabs models (elevenlabs/…) take one of these voice names (case-insensitive): george, sarah, adam, alice, bella, bill, brian, callum, charlie, chris, daniel, eric, harry, jessica, laura, liam, lily, matilda, river, roger, will. voice may be omitted for ElevenLabs models (default george). Any other value returns 400 invalid_voice. Your own custom voice (voice_…) is described in the Custom voices section below.
OpenAI-style voice names such as alloy, echo or nova only work with models that list them. Check the model page for each model's voices.
Custom voices (cloning) are being opened in stages: see the Custom voices section below (POST /v1/voices). Until they are enabled for your account, use one of the 21 preset names above or a public voice ID.
Built-in voices
Set voice to one of the names below (lowercase). Each voice has a short preview clip of our own, and GET /api/v1/audio/voices returns the full list (gender, age group, accent, style and preview URLs).
?lang= (en, zh-TW, zh-CN; default follows Accept-Language) only chooses the language of description. The preview URLs do not change with it: preview_urls.en (same as preview_url) is the English clip and preview_urls.zh (same as preview_url_zh) is the Chinese clip.
| Voice | Description | Preview |
|---|---|---|
| george | Male, middle-aged, British accent. Mature and steady, suited to narration and storytelling. | |
| sarah | Female, young adult, American accent. Professional and clear, suited to broadcast-style reading. | |
| adam | Male, middle-aged, American accent. Everyday and approachable, suited to short social videos. | |
| alice | Female, middle-aged, British accent. Professional and informative, suited to explainers and teaching. | |
| bella | Female, middle-aged, American accent. Professional and informative, suited to explainers and teaching. | |
| bill | Male, senior, American accent. Crisp and direct, suited to advertising voice-overs. | |
| brian | Male, middle-aged, American accent. Polished and refined, suited to social and brand content. | |
| callum | Male, middle-aged, American accent. Expressive, suited to characters and animation. | |
| charlie | Male, young adult, Australian accent. Energetic and lively, suited to conversation. | |
| chris | Male, middle-aged, American accent. Relaxed and casual, suited to conversation. | |
| daniel | Male, middle-aged, British accent. Formal and measured, suited to news-style and educational reading. | |
| eric | Male, middle-aged, American accent. Polished and warm, suited to conversation. | |
| harry | Male, young adult, American accent. Rough and gritty, suited to character voices. | |
| jessica | Female, young adult, American accent. Bright and cute, suited to conversation. | |
| laura | Female, young adult, American accent. Playful with attitude, suited to social content. | |
| liam | Male, young adult, American accent. Confident and upbeat, suited to social content. | |
| lily | Female, middle-aged, British accent. Confident and clear, suited to explainers and teaching. | |
| matilda | Female, middle-aged, American accent. Upbeat and friendly, suited to explainers and teaching. | |
| river | Neutral voice, middle-aged, American accent. Calm and even, suited to conversation. | |
| roger | Male, middle-aged, American accent. Polished and confident, suited to conversation. | |
| will | Male, young adult, American accent. Laid-back and easygoing, suited to conversation. |
Emotion and action tags (audio tags)
Write tags in square brackets directly inside input, for example [laughs], [whispers], [excited], [sighs], [crying], [curious] or [softly]. They are sent to the model exactly as typed and shape how the following words are performed. Keep the tags in English even when the text is in another language.
curl https://api.bazaarlink.ai/v1/audio/speech \
-H "Authorization: Bearer $BAZAARLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"elevenlabs/eleven-v3","input":"[laughs] That was actually funny. [whispers] Do not tell anyone.","voice":"george","response_format":"mp3"}' \
--output audio-tags.mp3Supported by elevenlabs/eleven-v3 and the elevenlabs/eleven-v4 family. Other speech models do not interpret tags and may read the brackets aloud, so try a short sentence first.
Tags count as input characters and are billed like the rest of the text.
Output formats
response_format defaults to mp3 (Content-Type audio/mpeg) when omitted; pcm (audio/pcm, raw 16-bit PCM) also works. The API accepts opus, aac, flac and wav, but ElevenLabs models currently reject them with 400. Save the file using the Content-Type response header.
Pricing
Speech is billed per character of input. The per-character price is on each model page under /models and in GET /v1/models as pricing.character (USD per character). Model pages show it per 1M characters.
Examples
curl https://api.bazaarlink.ai/v1/audio/speech \
-H "Authorization: Bearer $BAZAARLINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"elevenlabs/eleven-flash-v2.5","input":"Hello from BazaarLink.","voice":"george","response_format":"mp3"}' \
--output speech.mp3Common errors
| Status | Cause and fix |
|---|---|
| 400 | Invalid request: model, input or voice missing; input over 4,096 characters; speed outside 0.25–4.0; unsupported response_format; Unknown voice (wrong voice for this model); unknown_model (check the id on /models). |
| 401 | Missing or invalid API key. Send Authorization: Bearer with your BazaarLink key. |
| 402 | Insufficient credits. Top up and retry. |
| 403 | A management key cannot call models, or the account is suspended. Use a standard API key. |
| 429 | Rate limit reached. Wait for the Retry-After header and retry. |
| 502 | The model service is temporarily unavailable or the audio transfer was interrupted. Retry; failed requests are not charged. |
Speech synthesis
Convert text to audio using an id from /v1/models?output_modalities=speech. Billing uses the model page price per million characters. The complete audio is buffered before returning binary data; incremental streaming is not supported. Routing control fields provider, transforms, route, service_tier, and preset are ignored.
/v1/audio/speech/v1/chat/completionsUse audio or input_audio with /v1/chat/completions and an audio-capable model. Configured input/output token rates apply uniformly to inclusive reported text and audio tokens.
curl https://api.bazaarlink.ai/v1/chat/completions \
-H "$BAZAARLINK_AUTH_HEADER" \
-H "Content-Type: application/json" \
-d '{"model":"<audio-chat-model-id>","messages":[{"role":"user","content":"Say hi."}],"stream":true,"modalities":["text","audio"],"audio":{"voice":"alloy","format":"pcm16"},"max_tokens":32}'