音频模型接口参考创建语音任务

创建语音任务

提交文本和音色,异步生成语音。通过 model 选择 indextts-2(默认)或 indextts-2.5;voice_preset_id、voice_asset_id 和 voice_ref_key 互斥。indextts-2 支持情绪参考音频或八维情绪向量,文本最多 2048 个字符;indextts-2.5 须指定 language,支持 speed 和 emo_text,文本最多 2000 个字符。

认证

API Key:X-API-Key: <API Key> 或 Authorization: Bearer <API Key>。

示例中的凭证为占位值,请替换后在服务器端运行。

代码示例

curl -X POST 'https://shixux.com/api/v1/tts' \  -H 'X-API-Key: yb_xxx_yyy' \  -H 'Content-Type: application/json' \  -H 'Idempotency-Key: your-unique-business-action-id' \  -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}'
{  "id": "job_xxx",  "type": "tts",  "status": "queued",  "reserved_credits": 1,  "estimate_detail": {}}

请求头参数

Idempotency-Key?|

幂等键,最长 128 个字符。重试同一请求时使用相同的值;同一个键用于不同的请求时返回 409。

请求体

application/json
  1. body
emo_alpha?Emo Alpha

八维情绪向量的整体强度,范围 0–1。使用情绪参考音频时保持默认值 1。仅 indextts-2 支持。

范围0 <= value <= 1
默认1
emo_ref_key?|

情绪参考 WAV 的引用值,最大 20 MiB,仅 indextts-2 支持。通过上传接口登记的情绪参考请使用 emo_asset_id。

model?Model

模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。

默认"indextts-2"
可选值"indextts-2""indextts-2.5"
language?Language

语言。语音合成和音频编排仅在 model 为 indextts-2.5 时使用,且必须提供,取值为 ZH、EN 或 JA;音色设计使用其配置接口允许的语言代码。

可选值"ZH""EN""JA"
speed?Speed

语速倍率,范围 0.5–2,默认 1,仅 model 为 indextts-2.5 时可用。

范围0.5 <= value <= 2
默认1
emo_vector?array<>|

八维情绪向量,顺序固定为高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。共 8 项,每项范围 0–1.4。与情绪参考音频互斥,仅 indextts-2 支持。

text*Text

要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。

长度1 <= length <= 2048
voice_asset_id?|

当前账号的音色资产 ID,例如已保存的设计音色,或以 purpose 为 voice_reference 上传并确认的声音参考,须未过期。

voice_preset_id?|

预置音色 ID,来自预置音色目录。与 voice_asset_id 和 voice_ref_key 互斥。

voice_ref_key?|

声音参考的引用值,与 voice_preset_id、voice_asset_id 互斥。通过上传接口登记的声音参考请使用 voice_asset_id。

webhook_endpoint_id?|

任务结束时接收通知的 Webhook 端点 ID,须属于当前账号且已启用。

emo_asset_id?string

情绪参考素材 ID:以 purpose 为 emotion_reference 上传并确认的 WAV,须属于当前账号且未过期。与 emo_ref_key 互斥,仅 indextts-2 支持。

格式uuid

响应体

请求成功

application/json
  1. response
estimate_detail*
id*Id
reserved_credits*Reserved Credits
status*JobStatus
可选值"queued""processing""succeeded""failed""cancelled"
type*JobType
可选值"tts""avatar""video""video_analysis""image""voice_design""audio_composition"

本页目录