API 参考
视频
/v1/videos/v1/videos/{task_id}/v1/videos/{task_id}/content异步视频生成(Seedance、可灵、Veo、万相、Grok Imagine 等)。/v1/videos 用同一种 OpenAI 格式的请求支持文生视频和图生视频,返回 task_id 供轮询,也可以在提交时注册回调。
#请求参数
modelstring必填视频模型 ID,见模型页,例如 doubao-seedance-2.5。
promptstring必填场景描述;image2video 场景下用于控制运动。
imagestring可选仅 image2video:首帧图片,URL 或 base64。
imagesarray可选适用于支持单任务多参考图的供应商,用来传入多张参考帧。
durationnumber可选片长(秒)——计费档位维度之一;支持的取值见模型卡。
secondsnumber可选部分模型家族用它表示片长;推荐优先使用 duration。
resolutionstring可选当模型支持时,用于指定 720p、1080p 等输出分辨率档位。
sizestring可选适用于使用宽 x 高尺寸体系的模型家族,用于选择画幅或尺寸。
webhook_urlstring可选任务到达终态时回调的 HTTPS 地址——回调契约见视频指南。
webhook_secretstring可选设置后,回调带 X-Xiaoxiang-Signature: sha256=hex(HMAC-SHA256(body, secret))。
厂商参数透传
失败任务自动退款
#取消进行中的任务
/v1/videos/:task_id终止一个尚未进入终态的任务。成功后预扣额度会退回,任务被记为 failed、原因是 "cancelled by user",你注册的 webhook 会以 task.failed 投递。
多数厂商不支持取消
curl -X DELETE https://www.aisplice.store/v1/videos/task_xxx \
-H "Authorization: Bearer sk-YOUR_KEY"{
"id": "task_xxx",
"task_id": "task_xxx",
"status": "cancelled"
}注意 "cancelled" 只出现在这一次响应里。之后再轮询,任务会显示为 failed——因为它被置成了这个状态。
- 404 task_not_exist任务 ID 不存在,或属于其他账号。
- 409 task_not_cancellable任务已经结束——没有可终止的内容。
- 501 task_cancel_not_supported该厂商没有提供取消接口。
#基于已有视频重绘(remix)
/v1/videos/:video_id/remix在支持的模型上,用新的提示词重新生成一个已完成的视频。只需要传 prompt:模型、时长、分辨率和计费因子全部继承自原任务,请求也会被锁定到当初出图的那个渠道。
curl https://www.aisplice.store/v1/videos/task_xxx/remix \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: remix-of-task_xxx" \
-d '{"prompt": "Same shot, at night"}'{
"task_id": "task_yyy",
"status": "queued",
"remixed_from_video_id": "task_xxx"
}remix 是一个全新的计费任务
- 400 invalid_requestremix 必须传 prompt。
- 400 task_not_exist源视频 ID 不存在,或属于其他账号。
- 400 task_channel_disable生成原视频的渠道已被禁用。
#相关错误码
- 404 not_found路径不存在、模型名不存在,或 task_id 已过期 / 不属于当前账号。
- 422 unprocessable_entity上游拒绝了网关转发的参数值(如不支持的尺寸或时长)。
- 401Bearer 令牌无效或缺失。这条路径不带 error.code,请按状态码判断。
- 402 insufficient_user_quota钱包余额不足以覆盖预扣估算。
- 429密钥级限流。响应体为空,按 Retry-After 等待。若 429 带有 insufficient_user_quota,那是每日消费上限,不是限流。
- 503 model_not_found模型名不存在,或当前没有健康渠道可以服务它。
#请求示例
# submit
curl https://www.aisplice.store/v1/videos \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "doubao-seedance-2.5", "prompt": "A drone shot of a lighthouse at dawn"}'
# poll every 5s
curl https://www.aisplice.store/v1/videos/$TASK_ID -H "Authorization: Bearer sk-YOUR_KEY"
# download when completed
curl -L https://www.aisplice.store/v1/videos/$TASK_ID/content -o out.mp4 -H "Authorization: Bearer sk-YOUR_KEY"#响应
// POST — submit accepted
{"task_id": "task_xxx", "status": "queued"}
// GET /v1/videos/{task_id}
{
"task_id": "task_xxx",
"status": "in_progress", // queued | in_progress | completed | failed
"progress": "45%"
}
// terminal state
{
"task_id": "task_xxx",
"status": "completed",
"metadata": {"url": "https://…"}
}还是没解决?
把请求 ID 或报错信息发给我们,我们来查。