About
Eleven Multilingual v2 is ElevenLabs' lifelike multilingual model for 29 languages; it has higher latency than the Flash models. Infron serves it through the OpenAI-compatible POST /v1/audio/speech endpoint with any ElevenLabs voice ID, mp3, opus, pcm or wav output and optional streaming. A request takes up to 10,000 characters and is billed per character.
1. Calling the API
Setup your API Key
To begin using Infron, create an account and generate your API Key.
export INFRON_KEY="YOUR_API_KEY"
Submit a request
Send JSON to POST https://llm.onerouter.pro/v1/audio/speech with your Infron API key. The request and response follow the OpenAI speech API, so the OpenAI SDKs work with the base URL https://llm.onerouter.pro/v1. The examples use the ElevenLabs voice JBFqnCBsd6RMkjVDRZzb. Replace YOUR_API_KEY with your key.
curl
curl https://llm.onerouter.pro/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "elevenlabs/eleven-multilingual-v2/text-to-audio",
"voice": "JBFqnCBsd6RMkjVDRZzb",
"input": "Hello! Welcome to Infron.",
"response_format": "mp3"
}' \
--output speech.mp3
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://llm.onerouter.pro/v1",
api_key="YOUR_API_KEY",
)
with client.audio.speech.with_streaming_response.create(
model="elevenlabs/eleven-multilingual-v2/text-to-audio",
voice="JBFqnCBsd6RMkjVDRZzb",
input="Hello! Welcome to Infron.",
response_format="mp3",
) as response:
response.stream_to_file("speech.mp3")
TypeScript (OpenAI SDK)
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://llm.onerouter.pro/v1",
apiKey: "YOUR_API_KEY",
});
const response = await client.audio.speech.create({
model: "elevenlabs/eleven-multilingual-v2/text-to-audio",
voice: "JBFqnCBsd6RMkjVDRZzb",
input: "Hello! Welcome to Infron.",
response_format: "mp3",
});
fs.writeFileSync("speech.mp3", Buffer.from(await response.arrayBuffer()));
Response
A successful request returns HTTP 200 with the audio file as the body, not JSON. Content-Type follows response_format: audio/mpeg for mp3, audio/opus for opus, audio/pcm for pcm, audio/wav for wav. The examples above save it as speech.mp3.
Streaming
Add "stream_format": "sse" to receive Server-Sent Events while the audio is generated. Each speech.audio.delta event carries the next base64 chunk of the audio in response_format; decode the chunks and append them in order. The stream ends with a speech.audio.done event that reports usage.
curl https://llm.onerouter.pro/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "elevenlabs/eleven-multilingual-v2/text-to-audio",
"voice": "JBFqnCBsd6RMkjVDRZzb",
"input": "Hello! Welcome to Infron.",
"response_format": "mp3",
"stream_format": "sse"
}' \
--no-buffer
data: {"type":"speech.audio.delta","audio":"<base64 audio chunk>"}
data: {"type":"speech.audio.delta","audio":"<base64 audio chunk>"}
data: {"type":"speech.audio.done","usage":{"input_tokens":25,"output_tokens":0,"total_tokens":25}}
In this example input_tokens is the billable character count of the input.
Routing and usage
This model is served by elevenlabs (ElevenLabs). Billing uses the character count ElevenLabs reports for the request (the input characters when it reports none). The audio response carries no usage; with streaming, speech.audio.done reports the billable count as usage.input_tokens.
Errors
Parameters this model does not accept are rejected with HTTP 400 before the request is sent to ElevenLabs, and nothing is charged. error.message explains the problem and ends with the request ID:
{
"error": {
"message": "voice is required (ElevenLabs voice_id) (request id: 20261111221810441285700pZnPkvCJ)",
"type": "infron_ai_error",
"param": "",
"code": "invalid_request_error"
}
}
Errors reported by ElevenLabs, such as an unknown voice ID, are returned with ElevenLabs's message. If a stream fails after it has started, an error event is sent instead of speech.audio.done.
2. Schema
Input
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
model | string | Yes | -- | elevenlabs/eleven-multilingual-v2/text-to-audio | Model ID. |
input | string | Yes | -- | Up to 10,000 characters | Text to synthesize. |
voice | string | Yes | -- | -- | ElevenLabs voice ID, for example JBFqnCBsd6RMkjVDRZzb. Use a voice from your ElevenLabs voice library or the ElevenLabs voices API (see Sources). |
response_format | string | No | mp3 | mp3, opus, pcm, wav | Audio format. Sent to ElevenLabs as mp3_44100_128, opus_48000_128, pcm_24000 and wav_24000. When streaming wav, ElevenLabs streams pcm_24000 and Infron adds the WAV header. |
speed | number | No | 1 | Validated by ElevenLabs | Speaking rate; below 1 is slower, above 1 is faster. Sent as voice_settings.speed and merged with any voice_settings you send. |
language | string | No | -- | ISO 639-1, e.g. en | Forces the language for the model and text normalization. Sent as language_code. ElevenLabs does not support it on Multilingual v2. |
text_normalization | boolean | No | ElevenLabs auto | true, false | Spell out numbers, dates and similar. Sent as apply_text_normalization on or off. |
stream_format | string | No | audio | audio, sse | sse streams Server-Sent Events (see Streaming). |
ElevenLabs fields
These fields are not part of the OpenAI speech API. Put them at the top level of the JSON body; with the OpenAI Python SDK pass them in extra_body.
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
voice_settings | object | No | -- | -- | Per-request voice settings: stability (default 0.5; lower is more expressive), similarity_boost (default 0.75), style (default 0), use_speaker_boost (default true) and speed (default 1). |
output_format | string | No | -- | e.g. mp3_22050_32, mp3_44100_192, pcm_16000, pcm_44100, wav_44100, opus_48000_64, ulaw_8000, alaw_8000 | ElevenLabs output format (codec, sample rate, bitrate). Takes precedence over response_format; wav_* is not available when streaming. |
seed | integer | No | -- | 0 to 4294967295 | Best-effort deterministic sampling. |
previous_text | string | No | -- | -- | Text that comes before this request, for continuity. |
next_text | string | No | -- | -- | Text that comes after this request, for continuity. |
previous_request_ids | array | No | -- | Up to 3 | ElevenLabs request IDs of the preceding generations; when set, previous_text is ignored. |
next_request_ids | array | No | -- | Up to 3 | ElevenLabs request IDs of the following generations; when set, next_text is ignored. |
pronunciation_dictionary_locators | array | No | -- | Up to 3 | Pronunciation dictionaries to apply in order: pronunciation_dictionary_id and optional version_id. |
apply_text_normalization | string | No | auto | auto, on, off | Text normalization mode; text_normalization sets it too. |
apply_language_text_normalization | boolean | No | false | true, false | Language-specific normalization (Japanese only); adds latency. |
Unsupported fields
| Field | Behavior |
|---|---|
instructions | Rejected with 400. Use inline audio tags such as [whispers] in the input where the model supports them. |
sample_rate, bit_rate | Ignored. Choose a sample rate and bitrate with output_format. |
| Other fields | Not forwarded to ElevenLabs. |
Output
| Parameter | Type | Range | Description |
|---|---|---|---|
| Response body | binary | mp3, opus, pcm, wav | The audio file in response_format (without stream_format=sse). |
Content-Type header | string | audio/mpeg, audio/opus, audio/pcm, audio/wav | MIME type of the audio. |
type | string | speech.audio.delta, speech.audio.done, error | Streaming event type. |
audio | string | Base64 | Next chunk of the audio (speech.audio.delta). |
usage.input_tokens | integer | Non-negative | Billable count of the input (speech.audio.done). |
usage.output_tokens | integer | 0 | Always 0 for this model. |
usage.total_tokens | integer | Non-negative | Sum of input and output. |
error | object | -- | message, type and code of a failure (error event). |
3. Detailed Pricing
| Model | Endpoint | Billing unit | Price |
|---|---|---|---|
| ElevenLabs: Eleven Multilingual v2 | elevenlabs | Per 1M characters | $80.00 |
Prices are in USD. Billing uses the character count ElevenLabs reports for the request (the input characters when it reports none).
Sources: Create speech, Stream speech, Models, Pricing.