Create Async TTS Task

Create an async long-text TTS task, supporting direct text input or text file for synthesis.

POST/v1/audio/speech/tasks

Authorization

AuthorizationstringheaderRequired
HTTP: Bearer Auth

Request Header

Content-Typeenum<string>Default:application/jsonRequired

The media type of the request body, please set it toapplication/jsonto ensure the correct format of the requested data.

Available options:application/json

Request Bodyapplication/json

modelstringRequired

Model code, optional values: u2-tts, u2-tts-clone, u2-tts-design

textstring

The text to be synthesized. When model is u2-tts, the maximum is 50,000 characters; when model is u2-tts-clone or u2-tts-design, the maximum is 20,000 characters. Either this or text_file_id is required.

text_file_idlong

The text file ID (txt) to be synthesized. When model is u2-tts, max 50,000 chars; when model is u2-tts-clone or u2-tts-design, max 20,000 chars. Either this or text is required.

voice_settingobjectRequired

Basic voice settings

voice_setting.voice_idstring

System/clone/design voice ID, can be obtained through the query available voices API

voice_setting.speedinteger

Speed range [0, 100], default 50.
See Voice Parameter Support for details.

voice_setting.volumeinteger

Volume range [0, 100], default 50.
See Voice Parameter Support for details.

voice_setting.pitchinteger

Pitch range [0, 100], default 50.
See Voice Parameter Support for details.

voice_setting.brightinteger

Brightness range [50, 100], default 50.
See Voice Parameter Support for details.

voice_setting.emotionstring

Pronunciation emotion. Optional values: happy, angry, depressed, whisper, loudly, neutral, corresponding to 6 emotions: happy, angry, depressed, whisper, loudly, and neutral. Currently only supported by the cn_male_chenyu speaker when language is Chinese and dialect is default.

voice_setting.languagestring

Pronunciation language. Optional values: zh, ja, ko, th, vi, id, ms, my, lo, km, tl, en.
Supported languages by voice:
  • `cn_female_shasha`: `zh` (Chinese), `ja` (Japanese), `ko` (Korean), `th` (Thai), `vi` (Vietnamese), `id` (Indonesian), `km` (Khmer)
  • `cn_female_jiajia`: `zh` (Chinese), `id` (Indonesian), `ms` (Malay), `my` (Burmese), `lo` (Lao)
  • `cn_male_chenyu`: `zh` (Chinese), `tl` (Filipino)
  • `en_male_johnny`, `en_female_jane`: `en` (English)
  • Other system voices: `zh` (Chinese)

voice_setting.dialectstring

Pronunciation dialect. Optional values: `yueyu`, `sichuan`.
Currently, only the `cn_male_chenyu` voice supports the following two dialects:
  • `yueyu` (Cantonese)
  • `sichuan` (Sichuan dialect)

audio_settingobject

Audio output settings

audio_setting.audio_sample_rateinteger

Sample rate, enum [8000, 16000, 24000, 32000], default 32000

audio_setting.formatstring

Output format, enum [mp3, pcm], default mp3

audio_setting.channelinteger

Number of channels, enum [1]

pronunciation_dictobject

Custom pronunciation rules

pronunciation_dict.tonestring[ ]

Pronunciation/phonetic replacement rules, example: ["Liangshan/Liang<py>liang2</py>shan"].
See Custom Pronunciation Rules for tag details and support.

Response Body Structure

task_idstring

Unique identification ID of the current async synthesis task

file_idlong

Audio file ID returned when the task is successfully created

usage_charactersinteger

Number of characters consumed

base_respobject

base_resp.status_codeinteger

Request status code, 0 = normal

base_resp.status_msgstring

Status description, success indicates success

Voice Parameter Support

Support for speed, volume, pitch, and brightness by voice ID, language, and dialect:

Voice IDLanguageDialectspeedvolumepitchbright
cn_female_xiaodi_warmzhdefault
cn_male_chenyuzhdefault
cn_male_chenyuzhyueyu
cn_male_chenyuzhsichuan
cn_male_chenyutldefault
en_male_johnnyendefault
en_female_janeendefault
cn_male_chenyu_robotzhdefault
cn_male_chenyu_elderlyzhdefault
cn_male_chenyu_steadyzhdefault
cn_male_chenyu_fluentzhdefault
cn_female_shashazh, ja, ko, th, vi, iddefault
cn_female_shashakmdefault
cn_female_jiajiazhdefault
cn_female_jiajiaid, ms, my, lodefault
cn_female_ruolinzhdefault
cn_male_jingmingzhdefault
cn_female_shasha_intellectualzhdefault
cn_female_jiajia_intellectualzhdefault

Custom Pronunciation Rules

Use the following tags to control pronunciation and segmentation. Tag support varies by voice; see the support table below.

CategoryTagDescriptionExampleEffect
Number<value>Pronounce the digit string as a numeric value这是第<value>110</value>会议室这是第一百一十会议室
<code>Pronounce the digit string as a code (“1” as “一”)这是第<code>110</code>会议室这是一一零会议室
<tel>Pronounce the digit string as a phone number (“1” as “幺”)会议室分机号为<tel>110</tel>会议室分机号为幺幺零
Phonetics<py>Force the engine to pronounce Chinese characters with the specified pinyin搜索结果为<py>wei2</py>空<py>kong1</py>搜索结果为(wei2)空(kong1)
<pname>Correctly pronounce polyphonic characters used as surnames播放<pname>单田芳</pname>的评书播放单(shan4)田芳的评书
Segmentation<word>Force word segmentation to fix incorrect splits, e.g. distinguish “(乒乓球)(拍卖)(完了)” from “(乒乓)(球拍)(卖完了)”<word>乒乓</word><word>球拍</word><word>卖完了</word>(乒乓)(球拍)(卖完了)
<phrase>Force phrase breaks (longer pause than word) to fix incorrect phrasing, e.g. distinguish “(爸爸亲了我妈妈)(也亲了我)” from “(爸爸亲了我)(妈妈也亲了我)”<phrase>爸爸亲了我</phrase><phrase>妈妈也亲了我</phrase>(爸爸亲了我) (妈妈也亲了我)
English<letter>Spell the marked English text letter by letter世界卫生组织的英文缩写<letter>WHO</letter>世界卫生组织的英文缩写是(W)(H)(O)
Other<mute>Insert a pause of the specified duration (milliseconds)请您再说一遍<mute>300</mute>或说取消请您再说一遍(pause 300ms)或说取消
<sub>Replace the marked text with the alias attribute value when speaking气压的测量单位是<sub alias="毫米汞柱">mmHg</sub>气压的测量单位是毫米汞柱

Tag Support

Voice IDLanguageDialectSupported Tags
cn_female_xiaodi_warmzhdefaultAll supported
cn_male_chenyuzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_male_chenyuzhyueyuAll supported
cn_male_chenyuzhsichuanAll supported
cn_male_chenyutldefaultNot supported
en_male_johnnyendefaultAll supported
en_female_janeendefaultAll supported
cn_male_chenyu_robotzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_male_chenyu_elderlyzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_male_chenyu_steadyzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_male_chenyu_fluentzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_female_shashazh, ja, ko, th, vi, iddefaultPartial (value、code、tel、py、letter、sub、word)
cn_female_shashakmdefaultNot supported
cn_female_jiajiazhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_female_jiajiaid, ms, my, lodefaultNot supported
cn_female_ruolinzhdefaultPartial (value、code、tel、py、letter、sub、word)
cn_male_jingmingzhdefaultNot supported
cn_female_shasha_intellectualzhdefaultNot supported
cn_female_jiajia_intellectualzhdefaultNot supported