Skip to main content
Qwen-Audio-TTS

Qwen-Audio-TTS HTTP API

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

ParameterTypeRequiredDescription
AuthorizationstringRequiredThe authentication token in the format Bearer $DASHSCOPE_API_KEY.
Content-TypestringRequiredSet to application/json.
X-DashScope-SSEstringOptionalSet to enable for streaming output. If omitted, the complete result is returned.

Examples

  • Non-streaming
  • Streaming
# Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
curl -X POST "https://ap-southeast-1.maas.qwencloudapi.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
  }
}'
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

ParameterTypeRequiredDefaultDescription
modelstringRequired—The speech synthesis model ID. See Non-real-time speech synthesis for models and regions.
inputobjectRequired—The input parameters.
input.textstringRequired—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.voicestringRequired—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.formatstringOptionalmp3Audio encoding. Valid values: mp3, pcm, wav, and opus.
input.sample_rateintegerOptional22050Audio 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.volumeintegerOptional50Volume. Range: [0, 100].
input.ratefloatOptional1.0Speaking rate. Range: [0.5, 2.0].
input.bit_rateintegerOptional32Audio bitrate in kbps. Range: [6, 510]. Applies only when format=opus.
input.pitchfloatOptional1.0Pitch. Range: [0.5, 2.0].
input.enable_ssmlbooleanOptional—Whether to enable SSML. See Usage limits for model, voice, and interface restrictions.
input.word_timestamp_enabledbooleanOptionalfalseWhether to return word-level timestamps. Streaming output only. Cloned voices are supported. See the voice list for supported system voices.
input.seedintegerOptional0Random seed. Range: [0, 65535]. With the same model version, text, voice, and other parameters, the same seed reproduces the same synthesis result.
input.language_hintsarray[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.instructionstringOptional—An instruction controlling dialect, emotion, or role. See Instruction control for model and voice support and usage.
input.enable_aigc_tagbooleanOptionalfalseWhether to embed an invisible AIGC identifier in WAV, MP3, or Opus audio.
input.aigc_propagatorstringOptionalQwenCloud account IDThe ContentPropagator field of the identifier, identifying the distributor. Applies only with enable_aigc_tag=true.
input.aigc_propagate_idstringOptionalRequest ID of this requestThe PropagateID field of the identifier, identifying this distribution operation. Applies only with enable_aigc_tag=true.
input.hot_fixobjectOptional—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
Example text hotfix configuration:
{
  "hot_fix": {
    "pronunciation": [
      {
        "天气": "tian1 qi4"
      }
    ],
    "replace": [
      {
        "今天": "金天"
      }
    ]
  }
}

Response body

ParameterTypeDescription
request_idstringThe unique request identifier.
outputobjectThe model output.
output.finish_reasonstringThe stop reason. null means synthesis is in progress; stop means synthesis is complete.
output.typestringReturned 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_textstringA sentence segmented from the input text. May be absent for the final sentence.
output.sentenceobjectSentence information.
output.sentence.indexintegerThe sentence index, starting at 0.
output.sentence.wordsarrayWords in the sentence and their timestamps.
output.sentence.words[].textstringA word or character.
output.sentence.words[].begin_indexintegerThe start position in the sentence, starting at 0.
output.sentence.words[].end_indexintegerThe end position in the sentence, starting at 1.
output.sentence.words[].begin_timeintegerThe audio start timestamp of the word, in milliseconds.
output.sentence.words[].end_timeintegerThe audio end timestamp of the word, in milliseconds.
output.audioobjectThe synthesized audio.
output.audio.datastringA Base64 audio chunk for streaming output. Empty for non-streaming output.
output.audio.urlstringThe complete audio file URL, valid for 24 hours.
output.audio.idstringThe synthesized audio identifier.
output.audio.expires_atintegerThe expiry timestamp of url.
usageobjectUsage 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_tokensintegerInput tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash.
usage.output_tokensintegerOutput tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash.
usage.total_tokensintegerThe sum of input and output tokens. Applies only to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash.
usage.charactersintegerCumulative billable characters.
  • Non-streaming
  • 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"
}