Aliyun HappyHorse 异步 t2v/i2v/r2v 视频生成 (≤9 图参考)
POST /v1/videos/generations
Auth: {'type': 'bearer', 'prefix': 'sk-', 'description': 'API Key, `Authorization: Bearer sk-xxx`'}
## 官方文档参考 | 能力 | 模型 | 官方文档 | |---|---|---| | 文生视频 (t2v) | `happyhorse-1.0-t2v` | [HappyHorse-文生视频](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029820) | | 图生视频 (i2v · 基于首帧) | `happyhorse-1.0-i2v` | [HappyHorse-图生视频-基于首帧](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029821) | | 参考生视频 (r2v) | `happyhorse-1.0-r2v` | [HappyHorse-参考生视频](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030778) | | 视频编辑 (video-edit) | `happyhorse-1.0-video-edit` | [HappyHorse-视频编辑](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030779) | HappyHorse 1.0 视频生成. 提交任务后立即返 task_id, 通过 GET /v1/videos/generations/{id} 轮询. ## 协议格式 HappyHorse 1.0 用 Wan 2.7 风格的协议 — `input.media: [{type, url}]` 数组 + `parameters.resolution: "720P"` (大写P). | 能力 | input.media type | 数量 | |---|---|---| | t2v | (无, 仅 prompt) | — | | i2v | `first_frame` | 1 张 | | r2v | `reference_image` | 最多 9 张 | ## 字段责任划分 - 顶层 `model` / `duration` / `resolution` / `aspect_ratio`: 网关用于计费 - `input` / `parameters`: 完全透传给上游
model | string | required | HappyHorse 1.0 视频模型. 后缀 t2v/i2v/r2v 决定 input.media 内容 |
duration | integer | required | 视频时长 (秒). 网关计费用 |
resolution | string | required | 分辨率档位 (网关计费用). 客户端另需在 parameters.resolution 传 "720P" (大写 P) |
aspect_ratio | string | ||
input | object | required | 上游 input 字段透传: - t2v: 仅 `prompt` - i2v: `prompt` + `media: [{type:"first_frame", url}]` - r2v: `prompt` + `media: [{type:"reference_image", url}, ...]` (最多 9 张) |
parameters | object | 上游 parameters 字段透传: `resolution: "720P"` (大写P) + `duration` + 可选 `ratio: "16:9"` | |
webhook_url | string | 终态推送回调 URL (可选) |
202 — 任务已提交, 异步生成中200 — GET /v1/videos/generations/{id} 查询终态## ─── HappyHorse-1.0-t2v ───
curl -X POST https://api.router.ai/v1/videos/generations \
-H 'Authorization: Bearer sk-xxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.0-t2v",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"input": {
"prompt": "一座由硬纸板和瓶盖搭建的微型城市, 在夜晚焕发出生机"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
}'
## ─── HappyHorse-1.0-i2v (media.first_frame, 1 张) ───
curl -X POST https://api.router.ai/v1/videos/generations \
-H 'Authorization: Bearer sk-xxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.0-i2v",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"input": {
"prompt": "一只猫在草地上奔跑",
"media": [
{"type": "first_frame", "url": "https://example.com/cat.png"}
]
},
"parameters": {
"resolution": "720P",
"duration": 5
}
}'
## ─── HappyHorse-1.0-r2v (media.reference_image, 最多 9 张) ───
curl -X POST https://api.router.ai/v1/videos/generations \
-H 'Authorization: Bearer sk-xxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "happyhorse-1.0-r2v",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"input": {
"prompt": "身着红色旗袍的女性 图1, 镜头先以侧面中景勾勒...",
"media": [
{"type": "reference_image", "url": "https://example.com/girl.jpg"},
{"type": "reference_image", "url": "https://example.com/fan.jpg"},
{"type": "reference_image", "url": "https://example.com/earrings.jpg"}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
}'
## ─── 查询任务 ───
curl 'https://api.router.ai/v1/videos/generations/{task_id}' \
-H 'Authorization: Bearer sk-xxx'