Qwen: Qwen3 TTS Flash (Text to Audio) API Reference

About

Qwen3-TTS Flash is Alibaba Cloud Model Studio's multilingual speech synthesis model with system voices such as Cherry, available from the Singapore and China (Beijing) regions. It reads mixed-language text and takes a language hint for Chinese, English, German, Italian, Portuguese, Spanish, Japanese, Korean, French and Russian. 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 600 characters and is billed per character (a Chinese 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 Alibaba Cloud voice Cherry. 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": "qwen/qwen3-tts-flash/text-to-audio",
    "voice": "Cherry",
    "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="qwen/qwen3-tts-flash/text-to-audio",
    voice="Cherry",
    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: "qwen/qwen3-tts-flash/text-to-audio",
  voice: "Cherry",
  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": "qwen/qwen3-tts-flash/text-to-audio",
    "voice": "Cherry",
    "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 alibaba/cn (Alibaba Cloud Beijing) and alibaba/sg (Alibaba Cloud Singapore), at different prices (see Detailed Pricing). Infron routes each request to an available endpoint; to use one region only, add "provider": {"only": ["alibaba/sg"], "allow_fallbacks": false} to the request body (in extra_body with the Python SDK). Billing uses Alibaba Cloud's billable character count (a Chinese character counts as 2, SSML tags are not counted). 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 Alibaba Cloud, and nothing is charged. error.message explains the problem and ends with the request ID:

{
  "error": {
    "message": "voice is required (DashScope voice id) (request id: 20261111221810441285700pZnPkvCJ)",
    "type": "infron_ai_error",
    "param": "",
    "code": "invalid_request_error"
  }
}

Errors reported by Alibaba Cloud, such as an unknown voice ID, are returned with Alibaba Cloud's message. If a stream fails after it has started, an error event is sent instead of speech.audio.done.

2. Schema

Input

ParameterTypeRequiredDefaultRangeDescription
modelstringYes--qwen/qwen3-tts-flash/text-to-audioModel ID.
inputstringYes--Up to 600 charactersText to synthesize; mixed languages are allowed.
voicestringYes----Alibaba Cloud voice ID, for example Cherry. Use a system voice listed for this model in Model Studio, or a cloned or designed voice bound to it.
response_formatstringNowavwav, pcmAudio format. pcm is the same 24 kHz 16-bit mono audio without the WAV header.
languagestringNoAutoAuto, Chinese, English, German, Italian, Portuguese, Spanish, Japanese, Korean, French, RussianLanguage of the text; a specific language gives better quality than Auto. Sent as language_type.
stream_formatstringNoaudioaudio, ssesse streams Server-Sent Events (see Streaming).

Unsupported fields

FieldBehavior
speedRejected with 400 unless it is 1.
sample_rate, bit_rateRejected with 400. Output is 24 kHz.
instructionsRejected with 400. Choose a voice with the desired style or dialect.
text_normalizationIgnored.
Other fieldsNot forwarded to Alibaba Cloud.

Output

ParameterTypeRangeDescription
Response bodybinarywav, pcmThe audio file in response_format (without stream_format=sse).
Content-Type headerstringaudio/wav, audio/pcmMIME type of the audio.
typestringspeech.audio.delta, speech.audio.done, errorStreaming event type.
audiostringBase64Next chunk of the audio (speech.audio.delta).
usage.input_tokensintegerNon-negativeBillable count of the input (speech.audio.done).
usage.output_tokensinteger0Always 0 for this model.
usage.total_tokensintegerNon-negativeSum of input and output.
errorobject--message, type and code of a failure (error event).

3. Detailed Pricing

ModelEndpointBilling unitPrice
Qwen: Qwen3 TTS Flashalibaba/cnPer 1M characters$11.4682
Qwen: Qwen3 TTS Flashalibaba/sgPer 1M characters$10.00

Prices are in USD. Billing uses Alibaba Cloud's billable character count (a Chinese character counts as 2, SSML tags are not counted).

Sources: Qwen3-TTS API, Speech synthesis overview, Pricing.