The HTTP API for Qwen-Audio-TTS non-real-time speech synthesis, including non-streaming and SSE requests, request parameters, and response fields.
Endpoints
Replace YOUR_WORKSPACE_ID with the workspace ID for the region and use an API key for the same region.
Singapore
POST https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer
China (Beijing)
POST https://YOUR_WORKSPACE_ID.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer
Request headers
| Parameter | Type | Required | Description |
|---|---|---|---|
|
| Required | The authentication token in the format |
|
| Required | Set to |
|
| Optional | Set to |
Examples
Non-streaming
curl -X POST "https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-audio-3.1-tts-flash",
"input": {
"text": "你好,今天的天气真不错。",
"voice": "longanhuan_v3.1",
"format": "wav",
"sample_rate": 24000
}
}'
Streaming
curl --no-buffer -X POST "https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-H "X-DashScope-SSE: enable" \
-d '{
"model": "qwen-audio-3.1-tts-flash",
"input": {
"text": "你好,今天的天气真不错。",
"voice": "longanhuan_v3.1",
"format": "wav",
"sample_rate": 24000
}
}'
NoteAn SSE event may contain multiple data: lines. Combine all data: lines in the event before parsing JSON. Base64-decode and concatenate audio chunks in event order. The final frame has output.finish_reason=stop and returns the complete audio URL.
Request body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
|
| Required | — | The speech synthesis model ID. See Non-real-time speech synthesis for models and regions. |
|
| Required | — | The input parameters. |
|
| Required | — | Text to synthesize. Set |
|
| Required | — | The voice ID. For system voices, see the voice list. Create a custom voice with voice cloning or voice design, then synthesize with its bound target model. |
|
| Optional |
| Audio encoding. Valid values: |
|
| Optional | 22050 | Audio sample rate in Hz. Valid values: 8000, 12000, 16000, 22050, 24000, 44100, and 48000. With |
|
| Optional | 50 | Volume. Range: [0, 100]. |
|
| Optional | 1.0 | Speaking rate. Range: [0.5, 2.0]. |
|
| Optional | 32 | Audio bitrate in kbps. Range: [6, 510]. Applies only when |
|
| Optional | 1.0 | Pitch. Range: [0.5, 2.0]. |
|
| Optional | — | Whether to enable SSML. See Usage limits for model, voice, and interface restrictions. |
|
| Optional |
| Whether to return word-level timestamps. Streaming output only. Cloned voices are supported. See the voice list for supported system voices. |
|
| Optional | 0 | Random seed. Range: [0, 65535]. With the same model version, text, voice, and other parameters, the same seed reproduces the same synthesis result. |
|
| Optional | — | The target synthesis language. Only the first array element is processed. This is independent of the source language of a cloning sample. Set it for unexpected pronunciation of numbers, abbreviations, symbols, or less common languages. Language codes are listed below. For the cloning source language, see the voice cloning API. |
|
| Optional | — | An instruction controlling dialect, emotion, or role. See Instruction control for model and voice support and usage. |
|
| Optional |
| Whether to embed an invisible AIGC identifier in WAV, MP3, or Opus audio. |
|
| Optional | Alibaba Cloud UID | The |
|
| Optional | Request ID of this request | The |
|
| Optional | — | Text hotfix configuration. |
Language codes
zh: Chineseen: Englishfr: Frenchde: Germanja: Japaneseko: Koreanru: Russianpt: Portugueseth: Thaiid: Indonesianvi: Vietnamesees: Spanishit: Italianms: Malayfil: Filipinoar: Arabic
Example text hotfix configuration:
{
"hot_fix": {
"pronunciation": [
{
"天气": "tian1 qi4"
}
],
"replace": [
{
"今天": "金天"
}
]
}
}
Response body
| Parameter | Type | Description |
|---|---|---|
|
| The unique request identifier. |
|
| The model output. |
|
| The stop reason. |
|
| Returned only for streaming output. |
|
| A sentence segmented from the input text. May be absent for the final sentence. |
|
| Sentence information. |
|
| The sentence index, starting at 0. |
|
| Words in the sentence and their timestamps. |
|
| A word or character. |
|
| The start position in the sentence, starting at 0. |
|
| The end position in the sentence, starting at 1. |
|
| The audio start timestamp of the word, in milliseconds. |
|
| The audio end timestamp of the word, in milliseconds. |
|
| The synthesized audio. |
|
| A Base64 audio chunk for streaming output. Empty for non-streaming output. |
|
| The complete audio file URL, valid for 24 hours. |
|
| The synthesized audio identifier. |
|
| The expiry timestamp of |
|
| Usage information. Note |
|
| Input tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
|
| Output tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
|
| The sum of input and output tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
|
| Cumulative billable characters. |
Non-streaming
{
"output": {
"audio": {
"data": "",
"id": "audio_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"expires_at": 1792079569,
"url": "https://example.com/output.wav"
},
"finish_reason": "stop"
},
"usage": {
"input_tokens": 12,
"output_tokens": 30,
"total_tokens": 42,
"characters": 22
},
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Streaming
Intermediate result:
{
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"output": {
"finish_reason": null,
"type": "sentence-begin",
"original_text": "你好,今天的天气真不错。",
"sentence": {
"index": 0,
"words": []
},
"audio": {
"data": "",
"id": "audio_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"expires_at": 1792079569
}
}
}
Final result:
{
"output": {
"audio": {
"data": "",
"id": "audio_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"expires_at": 1792079569,
"url": "https://example.com/output.wav"
},
"finish_reason": "stop"
},
"usage": {
"input_tokens": 12,
"output_tokens": 30,
"total_tokens": 42,
"characters": 22
},
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}