API Reference
Text to speech Pro API
POST
tts-pro-api
ID 31
Higher-fidelity text to speech. Can be paired with Voice cloning Pro.
POST
https://xiaoapis.com/api/audio/audiosavepro
Overview
- 文本转语音
- 对接复刻音色
- 异步任务
Use cases
- 专业配音
- 批量合成
- 数字人驱动
Conventions
- Gateway ·
https://xiaoapis.com - Auth · send
key(query or JSON body, as this API specifies) - Response · JSON. Check the business code and the HTTP status, not only HTTP 200
Authentication
Send the platform API key (query parameter key or JSON field key, as this page specifies). Create one in API key management.
POST https://xiaoapis.com/api/audio/audiosavepro
Content-Type: application/json
{
"key": "YOUR_API_KEY"
}
Request example
https://xiaoapis.com/api/audio/audiosavepro?key=你的密钥
Details
请求HEADER:
| 名称 | 值 |
|---|---|
| Content-Type | application/x-www-form-urlencoded;charset=utf-8 或 application/json |
接口说明:
文本语音合成接口:将文本转为音频。音色ID通过「声音复刻PRO」或「声音设计PRO」获取。
关联接口:声音复刻PRO /api/audio/audiocopypro、声音设计PRO /api/audio/sounddesignpro
计费说明:
按量计费:默认 200 点/万字(约 2 元/万字)。字符统计:1个中文=2字符,1个英文字母、1个标点或句中空格=1字符。扣点公式:ceil(计费字符 × 单价 / 10000),至少 1 点。
默认返回转存后的 audio_url;若传 base64=true,则返回音频 Base64。
请求参数说明:
| 名称 | 必填 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| key | 是 | string | 你的平台密钥 | 接口密钥,在控制台→密钥管理查看 |
| text | 是 | string | 我像小草一样在发芽。 | 文本内容,单次不超过2000计费字符;建议使用中文符号;支持识别中小学常见数学表达式 |
| voice | 是 | string | voice-68e021aa448346fb8cc0575a163229eb | 音色ID,通过声音复刻PRO / 声音设计PRO 返回 |
| format | 否 | string | mp3 | 音频格式,默认mp3,支持 mp3、wav、pcm |
| sample_rate | 否 | string | 22050 | 采样率:8000 / 16000 / 22050 / 24000 / 44100 / 48000 |
| volume | 否 | string | 50 | 音量调整(0~100),默认50 |
| rate | 否 | string | 1.0 | 语速调整(0.5~2),默认1.0 |
| pitch | 否 | string | 1.0 | 音调调整(0.5~2),默认1.0 |
| base64 | 否 | string | true | 不传或空:返回 audio_url;传 true:返回 Base64 编码 |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| msg | string | 状态信息 |
| data | object | 结果数据 |
| - audio_url | string | 音频地址(未传 base64 时) |
| - base64 | string | 音频 Base64(base64=true 时) |
| - format | string | 音频格式 |
| - sample_rate | int | 采样率 |
| - billable_chars | int | 本次计费字符数 |
| - power_cost | number | 本次扣点 |
| exec_time | float | 执行耗时 |
| ip | string | 客户端IP |
错误码:
| 错误码 | 类型 | 说明 |
|---|---|---|
| 403 | int | 没有权限(密钥无效等) |
| 400 | int | 参数传递不正确 / 业务失败 |
| 500 | int | 服务器内部错误 |
Response example
{"code":200,"msg":"语音合成成功","data":{"audio_url":"https://xiaoapis.com/upload/audio/2026/07/15/ttspro_xxx.mp3","format":"mp3","sample_rate":22050,"billable_chars":20,"power_cost":1},"exec_time":1.2,"ip":"1.2.3.4"}
Error codes
| 错误码 | 类型 | 说明 |
|---|---|---|
| 403 | int | 没有权限(密钥无效等) |
| 400 | int | 参数传递不正确 / 业务失败 |
| 500 | int | 服务器内部错误 |
FAQ
PRO 与标准 TTS 如何选择?
按音质、功能与价格对照文档与控制台选择;能力字段不完全相同。
能否用复刻音色?
可以,按文档将复刻结果标识传入合成参数。
怎么调用?
提交文案、音色与 Key,异步查询结果。
返回什么?
音频地址及任务状态等,见返回示例。
适合数字人吗?
适合。将合成音频作为数字人驱动音频即可。
Related APIs
Full console doc (with the debugger):/doc/31