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
- China (Beijing)
POST https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizerRequest headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Required | The authentication token in the format Bearer <your_api_key>. |
Content-Type | string | Required | Set to application/json. |
X-DashScope-SSE | string | Optional | Set to enable for streaming output. If omitted, the complete result is returned. |
Examples
- Non-streaming
- Streaming
An 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 |
|---|---|---|---|---|
model | string | Required | — | The speech synthesis model ID. See Non-real-time speech synthesis for models and regions. |
input | object | Required | — | The input parameters. |
input.text | string | Required | — | Text to synthesize. Set enable_ssml=true for SSML input. LaTeX input requires no additional setting. See SSML and LaTeX for supported models, tags, and syntax. |
input.voice | string | 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. |
input.format | string | Optional | mp3 | Audio encoding. Valid values: mp3, pcm, wav, and opus. |
input.sample_rate | integer | Optional | 22050 | Audio sample rate in Hz. Valid values: 8000, 12000, 16000, 22050, 24000, 44100, and 48000. With format=opus, only 8000, 12000, 16000, 24000, and 48000 are supported. |
input.volume | integer | Optional | 50 | Volume. Range: [0, 100]. |
input.rate | float | Optional | 1.0 | Speaking rate. Range: [0.5, 2.0]. |
input.bit_rate | integer | Optional | 32 | Audio bitrate in kbps. Range: [6, 510]. Applies only when format=opus. |
input.pitch | float | Optional | 1.0 | Pitch. Range: [0.5, 2.0]. |
input.enable_ssml | boolean | Optional | — | Whether to enable SSML. See Usage limits for model, voice, and interface restrictions. |
input.word_timestamp_enabled | boolean | Optional | false | Whether to return word-level timestamps. Streaming output only. Cloned voices are supported. See the voice list for supported system voices. |
input.seed | integer | 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. |
input.language_hints | array[string] | 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. |
input.instruction | string | Optional | — | An instruction controlling dialect, emotion, or role. See Instruction control for model and voice support and usage. |
input.enable_aigc_tag | boolean | Optional | false | Whether to embed an invisible AIGC identifier in WAV, MP3, or Opus audio. |
input.aigc_propagator | string | Optional | Alibaba Cloud UID | The ContentPropagator field of the identifier, identifying the distributor. Applies only with enable_aigc_tag=true. |
input.aigc_propagate_id | string | Optional | Request ID of this request | The PropagateID field of the identifier, identifying this distribution operation. Applies only with enable_aigc_tag=true. |
input.hot_fix | object | Optional | — | Text hotfix configuration. pronunciation customizes pronunciation for specified words. replace replaces specified text before synthesis. |
Language codes
-
zh: Chinese -
en: English -
fr: French -
de: German -
ja: Japanese -
ko: Korean -
ru: Russian -
pt: Portuguese -
th: Thai -
id: Indonesian -
vi: Vietnamese -
es: Spanish -
it: Italian -
ms: Malay -
fil: Filipino -
ar: Arabic -
other: Other languages (supported by
qwen-audio-3.1-tts-flash) Bulgarian, Dutch, Hungarian, Romanian, Danish, Croatian, Greek, Czech, Norwegian, Swedish, Hindi, Slovak, Finnish, Urdu, Serbian, Mexican Spanish, Lithuanian, Latvian, Turkish, Persian, Hebrew, Mongolian, Slovenian, Azerbaijani, Polish, Catalan, Khmer, Brazilian Portuguese, Lao, Georgian, Afrikaans, Nepali, Belarusian, Malayalam, Luxembourgish, Albanian, Tamil, Sinhala, Telugu, Estonian, Cebuano, Bosnian, Burmese, Armenian, Latin, Icelandic, Maltese, Swahili, Kazakh, Seychellois Creole, Ukrainian.
Response body
| Parameter | Type | Description |
|---|---|---|
request_id | string | The unique request identifier. |
output | object | The model output. |
output.finish_reason | string | The stop reason. null means synthesis is in progress; stop means synthesis is complete. |
output.type | string | Returned only for streaming output. sentence-begin marks the start of a sentence; sentence-synthesis marks an audio chunk, with multiple chunks possible per sentence; sentence-end marks the end and includes usage. Audio chunks and data frames correspond one to one. Append chunks to the same file in order. |
output.original_text | string | A sentence segmented from the input text. May be absent for the final sentence. |
output.sentence | object | Sentence information. |
output.sentence.index | integer | The sentence index, starting at 0. |
output.sentence.words | array | Words in the sentence and their timestamps. |
output.sentence.words[].text | string | A word or character. |
output.sentence.words[].begin_index | integer | The start position in the sentence, starting at 0. |
output.sentence.words[].end_index | integer | The end position in the sentence, starting at 1. |
output.sentence.words[].begin_time | integer | The audio start timestamp of the word, in milliseconds. |
output.sentence.words[].end_time | integer | The audio end timestamp of the word, in milliseconds. |
output.audio | object | The synthesized audio. |
output.audio.data | string | A Base64 audio chunk for streaming output. Empty for non-streaming output. |
output.audio.url | string | The complete audio file URL, valid for 24 hours. |
output.audio.id | string | The synthesized audio identifier. |
output.audio.expires_at | integer | The expiry timestamp of url. |
usage | object | Usage information.qwen-audio-3.1-tts-flash is billed by input and output Tokens. qwen-audio-3.1-tts-plus, qwen-audio-3.0-tts-plus, and qwen-audio-3.0-tts-flash are billed by character. |
usage.input_tokens | integer | Input tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
usage.output_tokens | integer | Output tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
usage.total_tokens | integer | The sum of input and output tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash. |
usage.characters | integer | Cumulative billable characters. |
- Non-streaming
- Streaming