混剪生成
简介
请求 type: video、model: mixcut,在 input.urls 传公开素材视频链接列表,在 input.requirement 传自然语言混剪需求。提交时会探测所有素材、按输入实测时长 + 10 分钟输出上限预留积分,并返回 HTTP 202、job.id 和 queued/running 初始状态,不等待渲染完成。随后轮询 GET /v1/generations/{id};state 依次为 queued → running → done/failed,step 为 analyze → generate → render → done,完成后带 video_url。
请求
BASH
curl -X POST https://api.anycap.io/v1/generations \ -H "Authorization: Bearer $ANYCAP_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 6d2f9a1c-7b4e-4a8d-9f3c-2e5b8d1a7c60" \ -d '{"type":"video","model":"mixcut","input":{"urls":["https://mixcut-files.tos-cn-beijing.volces.com/ecommerce/8.mp4","https://mixcut-files.tos-cn-beijing.volces.com/ecommerce/9.mp4"],"requirement":"做一个22秒的产品种草短视频"}}'字段取值说明
type
取值
video说明必填
model
取值
mixcut说明必填
input.urls
取值HTTP(S) 链接
说明1–20 个公开视频文件,单文件 ≤100MB
input.requirement
取值自然语言
说明必填,最多 4,000 字符;可在需求中说明成片语言,例如中文或英文
Idempotency-Key
取值唯一键
说明建议使用;同一个键返回已存在的任务
返回
JSON
{ "type": "video", "job": { "id": "6d2f9a1c-7b4e-4a8d-9f3c-2e5b8d1a7c60", "state": "queued", "status": "queued", "step": "analyze", "urls": [ "https://mixcut-files.tos-cn-beijing.volces.com/ecommerce/8.mp4", "https://mixcut-files.tos-cn-beijing.volces.com/ecommerce/9.mp4" ], "requirement": "做一个22秒的产品种草短视频", "input_seconds": 22, "reserved_microcredits": 1415000000, "created_at": "2026-11-02T08:00:00Z", "updated_at": "2026-11-02T08:00:00Z" }}响应把任务放在 job 中。input_seconds、output_seconds 是计费用的实测时长;reserved_microcredits 是提交时的预留;结算后出现 charged_microcredits。失败任务带 error,并释放全部预留。
查询进度与成片
BASH
curl "https://api.anycap.io/v1/generations/$TASK_ID" -H "Authorization: Bearer $ANYCAP_API_KEY"TASK_ID 使用创建响应的 job.id(Anycap UUID)。每次查询返回后间隔 3 秒再查询;queued/running 继续等待,done 读取 job.video_url,failed 读取 job.error。video_url、output_seconds、completed_at 在可用前不返回。查询暂时失败不代表生成失败,重试 GET 即可,不要再次 POST 创建。非终态任务带 error 表示提交结果需核对,请联系管理员,勿重复提交。
JSON
{ "type": "video", "job": { "id": "6d2f9a1c-7b4e-4a8d-9f3c-2e5b8d1a7c60", "state": "done", "status": "done", "step": "done", "video_url": "https://cdn.example.com/output.mp4", "output_seconds": 22 }}错误
| HTTP | 响应 | 处理方式 |
|---|---|---|
| 202 | type=video、job | 保留 job.id,轮询 GET /v1/generations/{id}。 |
| 200 | type=video、job.state=done/failed | 读取 job.video_url 或 job.error。 |
| 400 | error.code=invalid_input | 修正 urls/requirement;本次未提交、未扣费。 |
| 402 | error.code=insufficient_credits | 补充积分后重试;本次未提交、未扣费。 |
| 503 | error.code=temporarily_unavailable | 先查询已有任务;使用同一请求编号确认,勿重复创建。 |