About
StepAudio 2.5 TTS is StepFun's contextual text-to-speech model: instructions (up to 200 characters) set the overall tone and persona, and text in parentheses inside the input gives inline directions that are not spoken. It supports Chinese, English, Japanese, Korean, French and Spanish (the last four in preview) and zero-shot cloned voices. Infron serves it through the OpenAI-compatible POST /v1/audio/speech endpoint with wav, mp3, flac, opus or pcm output and optional streaming. A request takes up to 1,000 characters. Billing counts a Chinese character as 1 and other non-space characters as 0.5.
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 StepFun voice zixinnansheng. 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": "stepfun/stepaudio-2.5-tts/text-to-audio",
"voice": "zixinnansheng",
"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="stepfun/stepaudio-2.5-tts/text-to-audio",
voice="zixinnansheng",
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: "stepfun/stepaudio-2.5-tts/text-to-audio",
voice: "zixinnansheng",
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/wav for wav, audio/flac for flac, audio/opus for opus, audio/pcm for pcm. 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": "stepfun/stepaudio-2.5-tts/text-to-audio",
"voice": "zixinnansheng",
"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":11,"output_tokens":0,"total_tokens":11}}
In this example input_tokens is the billable character count of the input.
Routing and usage
This model is served by stepfun (StepFun). Billing uses billable characters: a Chinese character counts as 1 and every two other non-space 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 StepFun, and nothing is charged. error.message explains the problem and ends with the request ID:
{
"error": {
"message": "voice is required (StepFun voice id) (request id: 20261111221810441285700pZnPkvCJ)",
"type": "infron_ai_error",
"param": "",
"code": "invalid_request_error"
}
}
Errors reported by StepFun, such as an unknown voice ID, are returned with StepFun'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 | -- | stepfun/stepaudio-2.5-tts/text-to-audio | Model ID. |
input | string | Yes | -- | Up to 1,000 characters | Text to synthesize. Text in parentheses, e.g. (lowered voice), is a non-spoken direction; do not wrap words that must be spoken in parentheses. |
voice | string | Yes | -- | -- | StepFun voice ID, for example zixinnansheng. Official voices are listed in StepFun's TTS guide (see Sources); your own cloned voice IDs also work. |
response_format | string | No | mp3 | mp3, wav, flac, opus, pcm | Audio format. |
speed | number | No | 1 | 0.5 to 2.0 | Speaking rate. |
instructions | string | No | -- | Up to 200 characters | Overall tone and persona in natural language. Sent as instruction. |
language | string | No | en | zh, en, ja, ko, fr, es | Language of the speech; ja, ko, fr and es are in preview. Cloned voices support zh and en. |
sample_rate | integer | No | 24000 | 8000, 16000, 22050, 24000, 48000 | Output sample rate. |
stream_format | string | No | audio | audio, sse | sse streams Server-Sent Events (see Streaming). |
StepFun 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 | 1 | 0.1 to 2.0 | Volume multiplier (0.1 = 10%, 2.0 = 200%). |
pronunciation_map | array | No | -- | -- | Pronunciation overrides: objects with a tone list of original/replacement entries, e.g. LOL/laugh out loudly; Chinese tones are numbered 1 to 5. |
markdown_filter | boolean | No | -- | true, false | Filter Markdown syntax out of the input. |
Unsupported fields
| Field | Behavior |
|---|---|
bit_rate, text_normalization | Ignored. |
| Other fields | Not forwarded to StepFun. |
Output
| Parameter | Type | Range | Description |
|---|---|---|---|
| Response body | binary | mp3, wav, flac, opus, pcm | The audio file in response_format (without stream_format=sse). |
Content-Type header | string | audio/mpeg, audio/wav, audio/flac, audio/opus, audio/pcm | 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 |
|---|---|---|---|
| StepFun: StepAudio 2.5 TTS | stepfun | Per 1M billable characters | $85.00 |
Prices are in USD. Billing uses billable characters: a Chinese character counts as 1 and every two other non-space characters count as 1.
Sources: Create speech, TTS guide and voices, Model, Pricing.