Call the Qwen-Audio-TTS non-real-time speech synthesis API over HTTP in non-streaming or streaming mode.
Endpoint
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/SpeechSynthesizer
Replace {WorkspaceId} with your actual workspace ID.
Request headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Authentication token in the format Bearer <your_api_key>. Replace <your_api_key> with your actual API key. |
| Content-Type | string | Yes | Media type of the request body. Fixed to application/json. |
| X-DashScope-SSE | string | No | Enables streaming mode for the response. Required for streaming synthesis. Set to enable. |
Request bodymodelstring(required)The speech synthesis model.input object(required)The input parameter object.
Properties text string(required)The text to synthesize.SSML and LaTeX format inputs are supported. Replace the text content with the corresponding format.
string(required)The voice for synthesis.Valid values:
string(optional)The audio format.Default value: mp3.Valid values:
integer(optional)The audio sample rate in Hz.Valid values: 8000, 12000, 16000, 22050 (default), 24000, 44100, 48000.When format is opus, sample_rate supports only 8000, 12000, 16000, 24000, and 48000.integer(optional)The volume level.Default value: 50.Valid values: [0, 100].rate float(optional)The speech rate.Default value: 1.0.Valid values: [0.5, 2.0].bit_rate integer(optional)The audio bitrate in kbps.Default value: 32.Valid values: [6, 510].pitch float(optional)The pitch.Default value: 1.0.Valid values: [0.5, 2.0].enable_ssml boolean(optional)Specifies whether to enable SSML. For the SSML usage restrictions (supported models, voices, and APIs), see Limitations.word_timestamp_enabled boolean(optional)Specifies whether to enable word-level timestamps.Default value: false.Available only in streaming output mode. Cloned voices are supported. For supported system voices, see Qwen-Audio-TTS voice list.seed integer(optional)The random seed for synthesis. Different seeds produce different outputs. With identical model version, text, voice, and other parameters, the same seed reproduces the same output.Default value: 0.Valid values: [0, 65535].language_hints array[string](optional)Specifies the target language for speech synthesis to improve output quality.Use this parameter when numbers, abbreviations, or symbols are not pronounced as expected, or when synthesis quality for secondary languages is poor. Examples:
Valid values
string(optional)An instruction that controls the synthesis behavior, such as dialect, emotion, or role.For usage details, see Non-real-time speech synthesis.enable_aigc_tag boolean(optional)Specifies whether to embed an AIGC watermark in the generated audio. When set to true, the watermark is embedded in audio files of supported formats (wav/mp3/opus).Default value: false.aigc_propagator string(optional)Sets the ContentPropagator field in the AIGC watermark, identifying the content propagator. Takes effect only when enable_aigc_tag is true.Default value: Alibaba Cloud UID.aigc_propagate_id string(optional)Sets the PropagateID field in the AIGC watermark, uniquely identifying a specific propagation action. Takes effect only when enable_aigc_tag is true.Default value: The request ID of the current speech synthesis request.hot_fix object(optional)Text hot-fix configuration. Customizes the pronunciation of specified words or substitutes text before speech synthesis.Parameters:
|
Response bodyrequest_idstringThe unique identifier of this request.output objectThe data returned by the model.
Properties finish_reason stringIndicates why synthesis stopped. The value is stop when synthesis completes normally.Valid values:
stringThe sub-event type. Returned only in streaming mode.Valid values:
stringA sentence extracted from the segmented input text. May be absent for the last sentence.sentence objectSentence information.
Properties index integerThe sentence index, starting from 0.words arrayWord-level information for the sentence.
Properties text stringThe word or character.begin_index integerThe start position index of the word within the sentence, starting from 0.end_index integerThe end position index of the word within the sentence, starting from 1.begin_time integerThe start timestamp of the word in the audio, in milliseconds.end_time integerThe end timestamp of the word in the audio, in milliseconds.objectThe synthesized audio data.
Properties data stringBase64-encoded audio data in streaming mode. Empty in non-streaming mode.url stringThe URL of the complete audio file generated by the model. Expires after 24 hours.id stringThe ID of the audio output from the model.expires_at integerThe expiration timestamp of the url.objectBilling usage.
Properties input_tokens integerInput token count for this request.Applies to qwen-audio-3.1-tts-flash.integerOutput token count for this request.Applies to qwen-audio-3.1-tts-flash.integerSum of input and output tokens.Applies to qwen-audio-3.1-tts-flash.integerCumulative number of billed characters.Applies to qwen-audio-3.0-tts-plus and qwen-audio-3.0-tts-flash. |
|