The HTTP API for Qwen-Audio-TTS non-real-time speech synthesis, including non-streaming and SSE requests, request parameters, and response fields.
Endpoints
The following endpoint is for Singapore (ap-southeast-1). For another region, replace ap-southeast-1 with the region code and use a QwenCloud API key created for that region. See Regions and endpoints.
POST https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/audio/tts/SpeechSynthesizer
Request headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Required | The authentication token in the format Bearer $DASHSCOPE_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 | QwenCloud account ID | 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: Chineseen: Englishfr: Frenchde: Germanja: Japaneseko: Koreanru: Russianpt: Portugueseth: Thaiid: Indonesianvi: Vietnamesees: Spanishit: Italianms: Malayfil: Filipinoar: Arabic
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. Note: 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