音色设计
根据自然语言提示词生成候选音色。同步接口,直接返回 base64 编码的 WAV 音频。
根据自然语言提示词生成短音频候选音色。适合在较长 TTS 流程或创建持久音色模型之前,先探索音色方向。
同步接口:提交后直接返回候选列表,无需轮询任务。仅接受 application/json,不支持 MessagePack、multipart 或内联参考音频。候选音频为 WAV 字节的 base64 编码。按成功请求计费一次,而非按候选条数。
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
Endpoints
POST /fishaudio/v1/voice-design
创建音色设计请求
传入音色描述提示词,响应返回一个或多个候选音色及其试听音频。
请求头必须设置 model: voice-design-1。多余字段会被拒绝。
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | 请求身份认证。格式:Bearer sk-xxxxxx |
Content-Type | string | Yes | 固定为 application/json |
model | string | Yes | 音色设计模型,固定为 voice-design-1 |
Request Body
Content-Type: application/json
Example:
{
"instruction": "Warm, confident studio narrator with a natural tone",
"reference_text": "Welcome to Fish Audio.",
"language": "en",
"n": 2,
"speed": 1,
"num_step": 32,
"guidance_scale": 2,
"instruct_guidance_scale": 0,
"seed": 42
}Properties:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
instruction | string | Yes | — | 音色设计提示词,描述音色、年龄、表达、语气、口音、节奏与场景。长度 1~2000 字符 |
reference_text | string | null | No | null | 可选试听文本。提供后各候选会朗读同一段文本,便于对比。最长 150 字符 |
language | string | null | No | null | 可选语种提示,如 en、zh、ja |
n | integer | No | 2 | 生成候选数量,取值 [1, 4] |
speed | number | No | 1. | 语速倍率,须大于 0 且不超过 3 |
num_step | integer | No | 32 | 扩散步数,取值 [1, 128] |
guidance_scale | number | No | 2. | Classifier-free guidance。值越高越贴近提示词,须 >= 0 |
instruct_guidance_scale | number | No | 0. | 提示词条件引导强度,须 >= 0 |
seed | integer | null | No | null | 可选确定性种子,便于复现候选生成 |
instructionstring(必选)
音色设计主提示词。用自然语言描述期望的声音特征,例如:
- 年龄与性别倾向
- 表达方式与语气(如温暖、自信、明亮)
- 口音、咬字与节奏
- 使用场景(如工作室旁白、产品更新播报)
长度限制为 1~2000 字符。
reference_textstring | null(可选)
试听文本。提供后,各候选会朗读该文本,便于在同一句话上对比音色。
- 建议保持简短
- 最长 150 字符
- 不传时仍会生成候选音频,但预览内容由模型决定
Responses
200: 生成成功
Content-Type: application/json
401: 无权限
Content-Type: application/json
402: 余额不足
Content-Type: application/json
503: 服务过载
Content-Type: application/json
请求示例
curl --request POST "https://api.autorouter.top/fishaudio/v1/voice-design" \
--header "Authorization: Bearer sk-xxxxxx" \
--header "Content-Type: application/json" \
--header "model: voice-design-1" \
--data '{
"instruction": "Warm, confident studio narrator with a natural tone",
"reference_text": "Welcome to Fish Audio.",
"language": "en",
"n": 2,
"speed": 1,
"num_step": 32,
"guidance_scale": 2,
"instruct_guidance_scale": 0,
"seed": 42
}'响应示例
{
"candidates": [
{
"id": "candidate-id",
"index": 0,
"audio_base64": "UklGRg...",
"sample_rate": 44100,
"duration_ms": 3100,
"text": "Welcome to Fish Audio.",
"language": "en"
}
]
}响应字段说明:
| Name | Type | Description |
|---|---|---|
candidates | object[] | 生成的音色候选列表 |
candidates[]. | string | 本次响应中稳定的候选标识 |
candidates[]. | integer | 候选序号,用于保持模型返回顺序,从 0 起 |
candidates[]. | string | Base64 编码的 WAV 音频,解码后即可写入文件 |
candidates[]. | integer | 采样率(Hz) |
candidates[]. | integer | 音频时长(毫秒) |
candidates[]. | string | null | 与该候选关联的试听文本(有则返回) |
candidates[]. | string | null | 与该候选关联的提示词(有则返回) |
candidates[]. | string | null | 检测到的或请求的语种(有则返回) |
接口为无状态:不会创建 batch、sample、音色模型或预签名 URL。可将解码后的音频用于试听;若要固化为可复用音色,请再调用创建模型接口。
错误处理
HTTP 400 参数错误(提交前拦截,不扣费)
AutoRouter 在提交到上游前会对必填字段做基础校验:
| 场景 | 响应 |
|---|---|
未传 instruction | {"code":"InvalidParameter","message":". |
未传或错误的 model Header | {"code":"InvalidParameter","message":". |
| 传入 MessagePack / multipart / 多余字段 | 请求被拒绝 |
鉴权失败、参数校验失败、余额不足、并发限制、上游错误以及空候选响应均不计费。
HTTP 401 / 403 鉴权错误
401 Unauthorized:API Key 无效或已过期403 Forbidden:API Key 无权访问此模型(检查 token 的模型白名单)
HTTP 402 余额不足
返回 insufficient user quota。请前往 AutoRouter 控制台充值。
HTTP 503 服务过载
服务端负载过高,无法处理请求。请稍后重试。