任务查询
统一查询任意任务的状态与结果(所有能力共用一套响应格式)
所有生成类接口都是异步的:创建后返回 task_id,再用这个统一接口轮询,直到拿到结果。
无论 voice / image / video,返回结构都一样,差异只在 result 字段。
GET /api/v2/tasks/{task_id}
鉴权:Authorization: Bearer sk_...
curl https://api.aiclonevoicefree.com/api/v2/tasks/b28f0341-3045-42e5-ad63-a5ccf4a1088e \
-H "Authorization: Bearer sk_your_api_key"统一响应格式
{
"task_id": "b28f0341-3045-42e5-ad63-a5ccf4a1088e",
"status": "completed",
"capability": "voice",
"action": "clone",
"model": "v1-real",
"progress": null,
"error": null,
"credits_used": null,
"created_at": 1780704348,
"completed_at": 1780704355,
"metadata": null,
"audioUrl": "https://oss.aiclonevoicefree.com/tts/.../xxxx.wav",
"providerUsed": "v1-async"
}任务完成后,结果字段直接铺在顶层,没有嵌套的 result 包。具体出现哪些字段取决于能力:
语音是 audioUrl、图片是 imageUrl、视频是 videoUrl(详见各能力页)。完成前没有这些结果字段。
| 字段 | 说明 |
|---|---|
task_id | 任务 ID |
status | pending / processing / completed / failed / cancelled |
capability | voice / image / video |
action | clone / vocal-conversion / generate / multi-segment … |
model | 实际使用的模型/子类型 |
progress | 0.0–1.0(当前阶段未填充,固定 null) |
audioUrl / imageUrl / videoUrl … | 结果字段,完成后铺在顶层(随能力不同);完成前不存在 |
error | 失败时填充 { code, message, type } |
credits_used | 本次消耗积分(Phase 2 接入,当前 null) |
created_at / completed_at | Unix 秒时间戳 |
metadata | 创建时透传的业务字段,原样回显 |
状态机
| status | 含义 | 客户端 |
|---|---|---|
pending | 已受理,未开始 | 继续轮询 |
processing | 处理中(排队 / 调上游 / 重试等待) | 继续轮询 |
completed | 完成 | 读结果字段(audioUrl / imageUrl / videoUrl …) |
failed | 失败 | 读 error |
cancelled | 已取消(预留) | —— |
各能力的 result 形态
voice(声音克隆 / 变声)
{ "_type": "tts.clone", "format": "wav", "audioUrl": "https://...", "degraded": false, "providerUsed": "tts-v2-emotion-1" }image(图片生成)
{ "_type": "image.generate", "imageUrl": "https://...", "width": 1024, "height": 1024 }video(视频生成)
{ "_type": "video.generate", "videoUrl": "https://...", "durationSeconds": 5 }轮询建议
提交后 2 秒 → 第一次查
之后 → 每 3–6 秒一次
视频 → 可能数分钟错误
| HTTP | 场景 |
|---|---|
401 | 缺少 / 无效 API Key |
404 | task_id 不存在 |