Text to Speech (text → audio)
yaoshu-audio provides non-realtime speech synthesis: send a piece of text and get a complete audio file back. It fits voice assistants, content voice-over, audiobooks, customer service, and similar scenarios. The OpenAI SDK's audio.speech.create() works as-is.
The platform's current HTTP contract returns the complete audio in a single request (the response body is the audio binary itself — write it to disk and you have the audio file, with no JSON wrapper). It is not a WebSocket and has no SSE — do not send streaming request headers when integrating.
1. Endpoint and Authentication
curl https://token.yaoshu.cc/v1/audio/speech \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "yaoshu-audio",
"input": "The weather is nice today — good for a walk.",
"voice": "longanhuan_v3.1",
"response_format": "mp3"
}' \
--output speech.mp3- Endpoint:
POST /v1/audio/speech - Authentication:
Authorization: Bearer sk-your-api-key(platform API Key) - Response:
200+ audio binary (Content-Typefollows the format, e.g.audio/mpeg); write it to disk directly
2. Complete Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | yaoshu-audio |
input | string / string[] | ✅ | Text to synthesize; an array is concatenated into one passage |
voice | string | ✅ | Voice ID, case-sensitive, must match the current model version (see "Full System Voice Table"). An invalid value returns a parameter error |
response_format | string | No | mp3 (default) / wav / pcm / opus |
speed | number | No | Speech rate [0.5, 2.0], default 1.0 |
sample_rate | number | No | Sample rate in Hz: 8000 / 12000 / 16000 / 22050 (default) / 24000 / 44100 / 48000. opus supports only 8000, 12000, 16000, 24000, 48000. Output can reach 48 kHz |
volume | number | No | Volume [0, 100], default 50 |
pitch | number | No | Pitch [0.5, 2.0], default 1.0 |
seed | number | No | [0, 65535], default 0. Reproducible with the same text, voice, and parameters |
language_hints | string[] | No | Only the first value is processed. Values: zh en fr de ja ko ru pt th id vi es it ms fil ar. Use it when numbers, abbreviations, symbols, or less common languages are read inaccurately |
instruction | string | No | Natural language controlling dialect, emotion, or role (see "Instruction Control"). instructions is a synonym; prefer instruction |
bit_rate | number | No | opus only, in kbps, [6, 510], default 32 |
word_timestamp_enabled | boolean | No | Word-level timestamps, default false. When true, the response switches from audio binary to JSON (see "Word-Level Timestamps") |
hot_fix | object | No | Text hot-fix, containing pronunciation (pinyin annotation on specified words to correct pronunciation) and replace (text replacement before synthesis). Structure: {"hot_fix":{"pronunciation":[{"天气":"tian1 qi4"}],"replace":[{"今天":"金天"}]}}. A malformed structure does not raise a server error — it silently synthesizes with default behavior — always send this exact structure |
enable_aigc_tag | boolean | No | Whether to embed an implicit AIGC label in the generated audio (supports wav / mp3 / opus), default false |
aigc_propagator | string | No | ContentPropagator of the implicit AIGC label; effective only with enable_aigc_tag=true; when omitted, the platform fills it with the default account identifier |
aigc_propagate_id | string | No | PropagateID of the implicit AIGC label (uniquely identifies one propagation); effective only with enable_aigc_tag=true; when omitted, the Request ID of this request is used |
3. Full System Voice Table (68 voices)
voice values are case-sensitive; voices are tightly bound to a model version, and mixing versions raises an error. The full table is grouped by function into four groups:
3.1 Multilingual and Dialect Voices (4)
All four voices support every dialect and language listed below, and you can switch dialect expression with instruction.
| Name | voice parameter | Gender |
|---|---|---|
| 龙安欢_v3.1 | longanhuan_v3.1 | Female |
| 龙安灵心_v3.1 | longanlingxin_v3.1 | Female |
| 龙安风悦_v3.1 | longanfengyue_v3.1 | Female |
| 许南川 | xunanchuan_v3.1 | Male |
These 4 voices all support:
- Dialects (8): Shanghainese, Cantonese, Northeastern Mandarin, Chongqing dialect, Shaanxi dialect, Yunnan dialect, Ningbo dialect, Gansu dialect (specified with
instruction, e.g. "please speak in Shaanxi dialect") - Languages (8): Japanese, Korean, French, German, Portuguese, Italian, Vietnamese, Indonesian
3.2 Premium Chinese Voices (22) — Mandarin Chinese only
| Name | voice parameter | Gender | Timbre | Use cases |
|---|---|---|---|---|
| 于小云 | yuxiaoyun_v3.1 | Female | Energetic, friendly, natural | Advertising, broadcasting, customer service assistant, narration |
| 乔小娇 | qiaoxiaojiao_v3.1 | Female | Pretty, cute | Advertising, customer service assistant, audiobooks |
| 夏小晨 | xiaxiaochen_v3.1 | Female | Energetic, bright | Advertising, audiobooks |
| 安明远 | anmingyuan_v3.1 | Male | Clear, natural | Advertising, audiobooks, narration |
| 温怀清 | wenhuaiqing_v3.1 | Female | Clear, gentle | Children's stories, customer service assistant, advertising, news broadcasting |
| 安小岚 | anxiaolan_v3.1 | Female | Sweet, pure | Audiobooks, customer service assistant, narration, news broadcasting, advertising |
| 谢舒柔 | xieshurou_v3.1 | Female | Gentle, natural, intellectual | Audiobooks, customer service assistant, narration |
| 白清岚 | baiqinglan_v3.1 | Female | Bright, pure | Voice assistant, customer service assistant |
| 许玉远 | xuyuyuan_v3.1 | Female | Intellectual, mature, textured | Advertising, news broadcasting, narration, customer service assistant, audiobooks |
| 安若柔 | anruorou_v3.1 | Female | Breathy, intellectual | Narration, voice assistant |
| 闻怀之 | wenhuaizhi_v3.1 | Female | Steady, mature | Audiobooks, news broadcasting, advertising, customer service assistant, narration |
| 萧行之 | xiaoxingzhi_v3.1 | Female | Dignified, refined | News broadcasting, audiobooks, narration, customer service assistant |
| 顾云舒 | guyunshu_v3.1 | Female | Mature, steady | Music radio, customer service assistant, audiobooks, narration |
| 霍拙石 | huozhuoshi_v3.1 | Male | Clear | Audiobooks, advertising, narration |
| 叶清禾 | yeqinghe_v3.1 | Female | Friendly, gentle | Audiobooks, advertising, narration, customer service assistant |
| 云欢欢 | yunhuanhuan_v3.1 | Female | High-pitched, passionate | Audiobooks, narration, customer service assistant |
| 徐小俏 | xuxiaoqiao_v3.1 | Female | Natural, playful | Audiobooks, narration, customer service assistant |
| 白安然 | baianran_v3.1 | Female | Deep, resonant, breathy | Voice-over explanation, audiobooks, narration |
| 许言初 | xuyanchu_v3.1 | Female | Calm, magnetic | News broadcasting, audiobooks |
| 叶知晴 | yezhiqing_v3.1 | Female | Light, natural | Children's stories, customer service assistant, voice assistant |
| 安迪 | andi_v3.1 | Male | ABC accent | Voice assistant |
| 安语晴 | anyuqing_v3.1 | Female | Sweet girlish | Voice assistant, narration, news broadcasting |
3.3 Premium English Voices (15) — English only
| Name | voice parameter | Gender | Accent |
|---|---|---|---|
| Emily | Emily_v3.1 | Female | British |
| Luna | Luna_v3.1 | Female | British |
| Eric | Eric_v3.1 | Male | British |
| Luca | Luca_v3.1 | Male | British |
| Abby | Abby_v3.1 | Female | American |
| Annie | Annie_v3.1 | Female | American |
| Ava | Ava_v3.1 | Female | American |
| Beth | Beth_v3.1 | Female | American |
| Betty | Betty_v3.1 | Female | American |
| Cally | Cally_v3.1 | Female | American |
| Cindy | Cindy_v3.1 | Female | American |
| Donna | Donna_v3.1 | Female | American |
| Andy | Andy_v3.1 | Male | American |
| Brian | Brian_v3.1 | Male | American |
| David | David_v3.1 | Male | American |
3.4 Other System Voices (27) — Mandarin Chinese (unless noted)
| Name | voice parameter | Gender | Timbre | Use cases |
|---|---|---|---|---|
| 龙安元妃_v3.1 | longanyuanfei_v3.1 | Female | Haughty imperial consort | Social companionship |
| 龙杰力豆_v3.1 | longjielidou_v3.1 | Male | Innocent boy | Children's companionship |
| 龙安灵希_v3.1 | longanlingxi_v3.1 | Female | Cute and sweet | Social companionship |
| 龙火火_v3.1 | longhuohuo_v3.1 | Male | Playful teenage boy | Character voice |
| 龙应桃_v3.1 | longyingtao_v3.1 | Female | Gentle and composed | Customer service |
| 龙安雅_v3.1 | longanya_v3.1 | Female | Elegant and refined | Social companionship |
| 龙婉_v3.1 | longwan_v3.1 | Female | Delicate and soft-spoken | Social companionship |
| 龙星_v3.1 | longxing_v3.1 | Female | Gentle, girl-next-door | Social companionship |
| 龙华_v3.1 | longhua_v3.1 | Female | Energetic and sweet | Social companionship |
| 龙寒_v3.1 | longhan_v3.1 | Male | Warm and devoted | Social companionship |
| 龙安智_v3.1 | longanzhi_v3.1 | Male | Wise, young-mature | Social companionship |
| 龙哲_v3.1 | longzhe_v3.1 | Male | Bland, warm-hearted | Social companionship |
| 龙安洋_v3.1 | longanyang_v3.1 | Male | Sunny young man | Social companionship (benchmark voice) |
| 李白_v3.1 | libai_v3.1 | Male | Ancient poet | Poetry recitation |
| 龙铃_v3.1 | longling_v3.1 | Female | Childish and flat | Children's voice |
| 龙牛牛_v3.1 | longniuniu_v3.1 | Male | Sunny boy | Consumer electronics — children's audiobooks |
| 龙闪闪_v3.1 | longshanshan_v3.1 | Male | Theatrical child | Consumer electronics — children's audiobooks |
| 龙泡泡_v3.1 | longpaopao_v3.1 | Female | Airy, bubble-like | Consumer electronics — children's companionship |
| loongstella_v3.1 | loongstella_v3.1 | Female | Crisp and decisive | News broadcasting |
| 龙媛_v3.1 | longyuan_v3.1 | Female | Warm and healing | Audiobooks |
| 龙妙_v3.1 | longmiao_v3.1 | Female | Melodic and expressive | Audiobooks |
| 龙三叔_v3.1 | longsanshu_v3.1 | Male | Steady and textured | Audiobooks |
| 龙安莉_v3.1 | longanli_v3.1 | Female | Crisp and poised | Voice assistant |
| 龙安温_v3.1 | longanwen_v3.1 | Female | Elegant and intellectual | Voice assistant |
| 龙安朗_v3.1 | longanlang_v3.1 | Male | Fresh and crisp | Voice assistant |
| 龙小夏_v3.1 | longxiaoxia_v3.1 | Female | Steady and authoritative | Voice assistant |
| 龙安冲_v3.1 | longanchong_v3.1 | Male | Passionate sales | Livestream commerce |
The full table is maintained from the same source as the voice list on the platform's service lines; a voice is listed only after group sampling validation on the platform side. Voice cloning and voice design (custom dedicated voices): the platform already has this capability; public availability is to be announced.
4. Emotion and Rich-Language Tags
Written into the text to synthesize (input), these tags take effect as-is with no extra parameters. Control tags apply to the text after them, up to the next control tag:
| Tag | Effect | Tag | Effect |
|---|---|---|---|
[sad] | Sad | [bored] | Bored |
[amazed] | Amazed | [tired] | Tired |
[deep and loud shouting] | Deep, loud shouting | [scornful] | Scornful |
[trembling] | Trembling | [shouting] | Shouting |
[angry] | Angry | [asmr] | ASMR soft whisper |
[excited] | Excited | [panicked] | Panicked |
[sarcastic] | Sarcastic | [mischievously] | Mischievous |
[curious] | Curious | [empathetic] | Empathetic |
[like dracula] | Deep and eerie | [whispers] | Whispering |
[reluctantly] | Reluctant | [crying] | Crying |
[serious] | Serious | [very slowly] | Very slowly |
[very fast] | Very fast |
Onomatopoeia tags insert an effect at that position only and do not change the surrounding emotion:
| Tag | Effect |
|---|---|
[gasp] | Gasp |
[sighing] | Sighing |
[clears throat] | Clears throat |
[giggles] | Giggles |
[laughing] | Laughing |
[cough] | Cough |
[snorts] | Snorts |
Combined example (control tags + onomatopoeia + emotion switching):
[excited]The weather is lovely today![laughing]Let's go out and play!
[serious]Please note the safety instructions.[excited]Alright, let's begin!5. Instruction Control (instruction)
instruction describes voice characteristics in natural language to set dialect, emotion, or role; it layers on top of the fixed voice. Do not write "imitate a certain celebrity" (not supported, and a copyright risk).
Writing tips: be specific, not vague ("low-pitched, slightly faster" beats "nice-sounding"); combine dimensions (gender + age + pitch + speed + emotion + traits + purpose):
- Broadcasting: "Read in standard Mandarin with a clear broadcast tone"
- Young female, on the fast side: "Young female voice, slightly fast, with a light and cheerful delivery"
- Steady male: "Steady male voice, slightly slow, clear articulation, deep and magnetic timbre, suitable for documentary narration"
- Gentle female: "Gentle female voice, slightly lower volume, mild delivery"
- Child: "Child voice, about 8 years old, higher pitch, lively delivery, suitable for animated character dubbing"
- Dialect: "Please speak in Chongqing dialect" (supported only by the 4 voices in the multilingual and dialect group)
6. Word-Level Timestamps (word_timestamp_enabled: true)
For scenarios that need "each word ↔ audio time" alignment — video dubbing subtitles, word-by-word highlighting (karaoke) and the like — add "word_timestamp_enabled": true to the request body: the response body switches from audio binary to JSON, delivering the audio (Base64) and per-word timestamps in one call, with no need to reverse-engineer alignment through speech recognition. Billing is unchanged when this is enabled.
{
"audio": "<Base64-encoded complete audio; decode it to get the audio file>",
"format": "mp3",
"duration": 1.0,
"words": [
{"text": "今", "begin_time": 0, "end_time": 62, "begin_index": 0, "end_index": 1},
{"text": "天", "begin_time": 62, "end_time": 125, "begin_index": 1, "end_index": 2}
]
}Timestamps are in milliseconds; duration is in seconds.
7. Errors and Handling
| Symptom | Cause | Handling |
|---|---|---|
| 400 parameter error (with a voice hint) | voice misspelled / voice from another version / unsupported format (flac, aac) | Check the voice table and the format value range, then resend |
| 400 parameter error (speed / pitch / volume) | Value outside the range in §2 | Adjust it into range |
| Odd pronunciation because voice and language do not match | A premium Chinese voice paired with English text (or vice versa) | Switch to a voice allowed by the group's language |
8. Limits
response_formatvalue range:mp3/wav/pcm/opus(flac/aacfrom the OpenAI protocol are not supported)sample_ratedefaults to 22050 — send it explicitly when you need 24 kHz or 48 kHz- Voices are tightly bound to the model version: only the
voicevalues in this page's full table are usable
9. SDK Access (OpenAI SDK, zero changes)
from openai import OpenAI
client = OpenAI(api_key="sk-your-api-key", base_url="https://token.yaoshu.cc/v1")
with client.audio.speech.create(
model="yaoshu-audio",
voice="longanhuan_v3.1",
input="Hello, this is a sample from the text-to-speech endpoint.",
) as response:
with open("speech.mp3", "wb") as f:
for chunk in response.iter_bytes():
f.write(chunk)10. Billing
Billed precisely by input character count (CNY per million characters, counting Unicode code points; the gateway counts regardless of channel); failed requests are not charged. The unit price is shown on the model pricing page in the console.
