创建语音任务
提交文本和音色,异步生成语音。通过 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 个字符。
认证
示例中的凭证为占位值,请替换后在服务器端运行。
代码示例
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- body
emo_alpha?Emo Alpha八维情绪向量的整体强度,范围 0–1。使用情绪参考音频时保持默认值 1。仅 indextts-2 支持。
0 <= value <= 11emo_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 <= 21emo_vector?array<>|八维情绪向量,顺序固定为高兴、愤怒、悲伤、害怕、厌恶、忧郁、惊讶、平静。共 8 项,每项范围 0–1.4。与情绪参考音频互斥,仅 indextts-2 支持。
text*Text要合成的文本,不能全为空白。语音合成中,indextts-2 最多 2048 个字符,indextts-2.5 最多 2000 个字符且须包含文字或数字;音频编排的台词合计最多 5000 个字符。
1 <= length <= 2048voice_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- response
estimate_detail*id*Idreserved_credits*Reserved Creditsstatus*JobStatus"queued""processing""succeeded""failed""cancelled"type*JobType"tts""avatar""video""video_analysis""image""voice_design""audio_composition"