本文档由 云音工坊 自动生成,如有疑问,请联系客服微信:yuntts !
stream 为控制合成结果的响应格式,开启返回二进制数据,关闭后返回json数据。| 响应头 | 说明 | 示例 |
|---|---|---|
| Content-Type | 音频 MIME 类型 | audio/mpeg(mp3)、audio/wav(wav)、audio/pcm(pcm)、audio/opus(opus) |
| Content-Length | 音频文件大小(字节) | 65536 |
| X-Characters | 合成字符数 | 150 |
| X-Cost | 扣费金额(元) | 0.021 |
| X-Task-Id | 任务唯一ID | fishaudio_664f8a1b2c3d4 |
Content-Type: application/json{
"url": "https://example.com/wp-content/uploads/audio/processed/202605/fishaudio_664f8a1b2c3d4.mp3",
"chars": 150,
"cost": 0.021,
"task_id": "fishaudio_664f8a1b2c3d4"
}| 字段 | 类型 | 说明 |
|---|---|---|
| url | string | 本地音频文件 URL |
| chars | integer | 合成字符数 |
| cost | number | 扣费金额(元) |
| task_id | string | 任务唯一ID |
| 模式 | Content-Type | 说明 |
|---|---|---|
| 模式一:基础音色合成 | application/json | 标准 JSON 请求体 |
| 模式二:多人对话模式 | application/json | 标准 JSON 请求体 |
| 模式三:零样本克隆 | application/msgpack 或 application/json | 传输二进制音频数据时推荐 msgpack;使用 JSON 时 audio 字段需 Base64 编码 |
references[].audio 可直接传二进制音频数据,传输效率更高references[].audio 需传 Base64 编码字符串,体积约为原始数据的 1.33 倍curl --location 'https://www.yuntts.com/api/v1/fish-audio/tts' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'model: s2-pro' \
--header 'Content-Type: application/json' \
--data '{
"text": "officia",
"stream": true,
"reference_id": "7f92f8afb8ec43bf81429cc1c9199cb1",
"temperature": 0.7,
"top_p": 0.7,
"chunk_length": 300,
"normalize": true,
"format": "mp3",
"sample_rate": 32000,
"mp3_bitrate": 128,
"opus_bitrate": -1000,
"latency": "normal",
"prosody": {
"speed": 94408517.47868052,
"volume": 10419835.572125763,
"normalize_loudness": false
},
"max_new_tokens": 1024,
"repetition_penalty": 1.2,
"min_chunk_length": 50,
"condition_on_previous_chunks": true,
"early_stop_threshold": 1
}'