Generate video asynchronously with Aliyun HappyHorse (t2v/i2v/r2v), with up to 9 reference images.
POST /v1/videos/generations
Auth: {'type': 'bearer', 'prefix': 'sk-', 'description': 'API Key, `Authorization: Bearer sk-xxx`'}
## official documentation reference | capability | Model | Official documentation | |---|---|---| | text-to-video (t2v) | `happyhorse-1.0-t2v` | [HappyHorse-text-to-video](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029820) | | image-to-video (i2v · based on first frame) | `happyhorse-1.0-i2v` | [HappyHorse-image-to-video-based-on-first-frame](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3029821) | | reference-to-video (r2v) | `happyhorse-1.0-r2v` | [HappyHorse-reference-to-video](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030778) | | video editing (video-edit) | `happyhorse-1.0-video-edit` | [HappyHorse-video-editing](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=api#/api/?type=model&url=3030779) | HappyHorse 1.0 video generation. Submit task and immediately return task_id; poll via GET /v1/videos/generations/{id} to check status. ## protocol format HappyHorse 1.0 using Wan 2.7 style protocol — `input.media: [{type, url}]` array + `parameters.resolution: "720P"` (uppercase P) | capability | input.media type | count | |---|---|---| | t2v | (none, only prompt) | — | | i2v | `first_frame` | 1 images | | r2v | `reference_image` | up to 9 images | ## field responsibility division - top-level `model` / `duration` / `resolution` / `aspect_ratio`: gateway used for billing - `input` / `parameters`: fully passed through to upstream
model | string | required | HappyHorse 1.0 video model. Suffix t2v/i2v/r2v determines input.media content |
duration | integer | required | Video duration in seconds. Used by the gateway for billing. |
resolution | string | required | Resolution tier used by the gateway for billing. The client must also pass "720P" (uppercase P) in parameters.resolution. |
aspect_ratio | string | ||
input | object | required | upstream input field passed through: - t2v: only `prompt` - i2v: `prompt` + `media: [{type:"first_frame", url}]` - r2v: `prompt` + `media: [{type:"reference_image", url}, ...]` (up to 9 images) |
parameters | object | upstream parameters field passed through: `resolution: "720P"` (uppercase P) + `duration` + optional `ratio: "16:9"` | |
webhook_url | string | final state callback URL (optional) |
202 — task submitted, asynchronously generating200 — GET /v1/videos/generations/{id} query final state## ─── 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'