生成视频并查询任务
视频是异步任务。提交成功只表示任务已进入系统,不表示视频已经生成完成。
调用入口
POST /v1/videos
GET /v1/videos/{task_id}
文生视频
curl -X POST http://localhost:9890/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_GATEWAY_KEY" \
-d '{
"model": "agnes-video-v2.0",
"prompt": "a cinematic orange cat walking through a rainy neon street",
"width": 1152,
"height": 768,
"num_frames": 121,
"frame_rate": 24
}'
图生视频
{
"model": "agnes-video-v2.0",
"prompt": "slow head turn, subtle background movement, natural motion",
"image": "https://example.com/input.jpg",
"width": 1152,
"height": 768,
"num_frames": 121,
"frame_rate": 24
}
首尾帧 / 关键帧
{
"model": "agnes-video-v2.0",
"prompt": "smoothly transition from the first frame to the second",
"images": [
"https://example.com/frame_start.jpg",
"https://example.com/frame_end.jpg"
],
"mode": "keyframes",
"width": 1152,
"height": 768,
"num_frames": 121,
"frame_rate": 24
}
查询任务
curl -H "Authorization: Bearer YOUR_GATEWAY_KEY" \
http://localhost:9890/v1/videos/TASK_ID
客户端应按合理间隔轮询,直到任务完成或失败。不要每秒大量重复查询。
常用时长
| 帧数 | 24 fps 约时长 |
|---|---|
| 81 | 3.4 秒 |
| 121 | 5 秒 |
| 161 | 6.7 秒 |
| 241 | 10 秒 |
| 441 | 18.4 秒 |
num_frames 使用 8n+1 形式,上限为 441。高分辨率长视频成本更高,先用 81 或 121 帧验证。