About
VUI Labs Luna TTS synthesizes Chinese, English, Japanese and Korean speech for voiceovers, narration and voice prompts, with system and cloned voices. Expression tags such as [laughs], [sighs] or [breath] go directly in the text. Infron serves it through the OpenAI-compatible POST /v1/audio/speech endpoint with wav or pcm output and optional streaming. A request takes up to 500 weighted characters and is billed per weighted character (a Chinese, Japanese or Korean character counts as 2).
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 VUI Labs voice avery. 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": "vui/luna-tts/text-to-audio",
"voice": "avery",
"input": "Hello! Welcome to Infron.",
"response_format": "wav"
}' \
--output speech.wav
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="vui/luna-tts/text-to-audio",
voice="avery",
input="Hello! Welcome to Infron.",
response_format="wav",
) as response:
response.stream_to_file("speech.wav")
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: "vui/luna-tts/text-to-audio",
voice: "avery",
input: "Hello! Welcome to Infron.",
response_format: "wav",
});
fs.writeFileSync("speech.wav", 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/wav for wav, audio/pcm for pcm. The examples above save it as speech.wav.
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": "vui/luna-tts/text-to-audio",
"voice": "avery",
"input": "Hello! Welcome to Infron.",
"response_format": "wav",
"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 vui (VUI Labs). Billing uses VUI's weighted character count (X-Luna-Billable-Characters): Chinese characters, Japanese kana and Korean Hangul count as 2, line breaks are not counted, other characters count as 1. 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 VUI Labs, and nothing is charged. error.message explains the problem and ends with the request ID:
{
"error": {
"message": "voice is required (VUI voice_id) (request id: 20261111221810441285700pZnPkvCJ)",
"type": "infron_ai_error",
"param": "",
"code": "invalid_request_error"
}
}
Errors reported by VUI Labs, such as an unknown voice ID, are returned with VUI Labs'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 | -- | vui/luna-tts/text-to-audio | Model ID. |
input | string | Yes | -- | Up to 500 weighted characters | Text to synthesize; whitespace at both ends is trimmed. Expression tags: [laughs], [chuckles], [sighs], [inhales], [breath], [exhale], [gasps], [coughs], [clears throat], [sniffles], [snorts], [hisses], [tsks], [groans]. |
voice | string | Yes | -- | -- | VUI voice ID, for example avery. List voices for this model with VUI's List Voices API (model_id=luna-tts); cloned voices also work. |
response_format | string | No | wav | wav, pcm | Audio format. pcm is signed 16-bit little-endian without a header; read the sample rate and channels from the X-Audio-Sample-Rate, X-Audio-Channels and X-Audio-Bit-Depth response headers. |
speed | number | No | 1 | 0.6 to 1.2 | Speaking rate. |
language | string | No | -- | zh, en, ja, ko | Language of the text. |
text_normalization | boolean | No | true | true, false | Normalize the text before synthesis; false keeps the input as written. |
stream_format | string | No | audio | audio, sse | sse streams Server-Sent Events (see Streaming). |
VUI Labs 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 |
|---|---|---|---|---|---|
volume | number | No | 0 | -5 to 5 (dB, step 0.1) | Volume adjustment. Applies to non-streaming requests only; omit it when streaming. |
Unsupported fields
| Field | Behavior |
|---|---|
instructions, sample_rate, bit_rate | Ignored. |
| Other fields | Not forwarded to VUI Labs. |
Output
| Parameter | Type | Range | Description |
|---|---|---|---|
| Response body | binary | wav, pcm | The audio file in response_format (without stream_format=sse). |
Content-Type header | string | audio/wav, audio/pcm | MIME type of the audio. |
X-Audio-Sample-Rate, X-Audio-Channels, X-Audio-Bit-Depth headers | integer | -- | Sample rate, channel count and bit depth of pcm output. |
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 |
|---|---|---|---|
| VUI Labs: Luna TTS | vui | Per 1M weighted characters | $15.00 |
Prices are in USD. Billing uses VUI's weighted character count (X-Luna-Billable-Characters): Chinese characters, Japanese kana and Korean Hangul count as 2, line breaks are not counted, other characters count as 1.
Sources: Text to speech API, Luna TTS, List voices, Pricing.