创建视频生成任务
本文档说明 Happy Horse 视频模型调用方式。
公共模型
| 公共模型 | 能力 | 分辨率档位 |
|---|---|---|
happy-horse-720p | 文生视频、图生视频、参考图生视频 | 720p |
happy-horse-1080p | 文生视频、图生视频、参考图生视频 | 1080p |
happy-horse-edit-720p | 视频编辑 | 720p |
happy-horse-edit-1080p | 视频编辑 | 1080p |
说明:
duration对所有 Happy Horse 公共模型都是必传参数,允许3到15秒。- 对视频编辑模型,
duration只用于计费和任务记录,编辑输出实际时长由输入视频决定,最多处理前15秒。 - 生成模型的
aspect_ratio只对文生视频和参考图生视频有效;图生视频由输入图片决定构图。 - 视频编辑模型不支持
aspect_ratio。
接口
提交任务:
POST /v1/videos/generations
Authorization: Bearer <api-key>
Content-Type: application/json
查询任务:
GET /v1/videos/generations/{task_id}
Authorization: Bearer <api-key>
参数说明
| 参数 | 类型 | 必填 | 适用模型 | 说明 |
|---|---|---|---|---|
model | string | 是 | 全部 | 公共模型名 |
prompt | string | 是 | 全部 | 提示词,最多 2500 字符 |
duration | integer | 是 | 全部 | 允许 3 到 15 秒;编辑模型仅用于外围计费 |
size | string | 否 | 全部 | 可选传同档位值:720p 模型传 720p,1080p 模型传 1080p |
seed | integer | 否 | 全部 | 随机种子,范围按 0 到 2147483647 |
aspect_ratio | string | 否 | 文生视频、参考图生视频 | 可选 16:9、9:16、1:1、4:3、3:4 |
image | string | 图生视频必填 | 图生视频 | 单张源图片 URL |
images | string[] | 参考图生视频必填 | 参考图生视频 | 1 到 9 张参考图片 URL |
reference_image_urls | string[] | 参考图生视频可用 | 参考图生视频 | images 的等价别名 |
图片约束:
- 图生视频
image支持jpeg、jpg、png、bmp、webp,图片尺寸至少300px,比例在1:2.5到2.5:1,最大10MB。 - 参考图生视频
images支持jpeg、jpg、png、webp,1 到 9 张,最短边至少400px,建议 720p 以上,单张最大10MB。 - 参考图生视频提示词中应使用
character1到character9指代图片角色。
视频编辑参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
video | string | 是 | 输入视频 URL |
reference_image_urls | string[] | 否 | 参考图片 URL,最多 5 张 |
audio_setting | string | 否 | 可选 auto 或 origin,默认使用上游默认 auto |
输入视频约束:
- 支持
mp4、mov,推荐 H.264。 - 输入视频时长
3到60秒。 - 长边不超过
2160px,短边不小于320px。 - 画面比例在
1:2.5到2.5:1。 - 帧率大于
8fps,文件最大100MB。
参考图片约束:
- 最多 5 张。
- 支持
jpeg、jpg、png、webp。 - 尺寸至少
300px,比例在1:2.5到2.5:1。 - 单张最大
10MB。
接口参数与示例
Endpoint
POST /v1/video/generations
Header 参数
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
Authorization | string | No | Bearer {your_token} |
请求体参数
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
model | string | Yes | 模型名称 | 公共模型名 |
prompt | string | Yes | 提示词 | 提示词,最多 2500 字符 |
image | string | Yes | 参考图URL | 单张源图片 URL,必须是公开可访问的URL图片链接 |
images | string | Yes | 参考图生视频 | 1 到 9 张参考图片 URL |
aspect_ratio | string | No | 画幅比例 | 可选 16:9、9:16、1:1、4:3、3:4 |
duration | string | No | 输出描述 | 允许 3 到 15 秒;编辑模型仅用于外围计费 |
seed | string | Yes | 随机种子 | 随机种子,范围按 0 到 2147483647 |
video | string | Yes | 输入视频URL | 必须是公开可访问的URL媒体链接 |
audio_setting | string | Yes | 可选 auto 或 origin,默认使用上游默认 auto | |
size | string | No | Example field | Appears in a request example; no separate field description is provided. |
reference_image_urls | array | No | Example field | Appears in a request example; no separate field description is provided. |
请求示例
文生视频
{
"model": "happy-horse-720p",
"prompt": "A cinematic wide shot of a white horse running across a misty grassland at sunrise, realistic motion, soft rim light.",
"duration": 4,
"aspect_ratio": "16:9",
"size": "720p",
"seed": 12345
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse-720p",
"prompt": "A cinematic wide shot of a white horse running across a misty grassland at sunrise, realistic motion, soft rim light.",
"duration": 4,
"aspect_ratio": "16:9",
"size": "720p",
"seed": 12345
}'
图生视频
{
"model": "happy-horse-1080p",
"prompt": "Animate the subject naturally, with subtle camera push-in and realistic cloth movement.",
"image": "https://example.com/source-frame.png",
"duration": 6,
"size": "1080p",
"seed": 67890
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse-1080p",
"prompt": "Animate the subject naturally, with subtle camera push-in and realistic cloth movement.",
"image": "https://example.com/source-frame.png",
"duration": 6,
"size": "1080p",
"seed": 67890
}'
参考图生视频
{
"model": "happy-horse-1080p",
"prompt": "character1 rides character2 through a futuristic city street, keep both identities consistent.",
"images": [
"https://example.com/character1.png",
"https://example.com/character2.png"
],
"duration": 8,
"aspect_ratio": "9:16",
"seed": 24680
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse-1080p",
"prompt": "character1 rides character2 through a futuristic city street, keep both identities consistent.",
"images": [
"https://example.com/character1.png",
"https://example.com/character2.png"
],
"duration": 8,
"aspect_ratio": "9:16",
"seed": 24680
}'
视频编辑
{
"model": "happy-horse-edit-720p",
"prompt": "Change the actor jacket into a red leather jacket while preserving motion, face identity, camera movement, and background.",
"video": "https://example.com/source-video.mp4",
"reference_image_urls": [
"https://example.com/jacket-reference.png"
],
"duration": 4,
"size": "720p",
"audio_setting": "origin",
"seed": 13579
}
curl -X POST "{BASE_URL}/v1/video/generations" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse-edit-720p",
"prompt": "Change the actor jacket into a red leather jacket while preserving motion, face identity, camera movement, and background.",
"video": "https://example.com/source-video.mp4",
"reference_image_urls": [
"https://example.com/jacket-reference.png"
],
"duration": 4,
"size": "720p",
"audio_setting": "origin",
"seed": 13579
}'
响应字段
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
id | string | Yes | 任务ID | |
object | string | Yes | 任务类型 | |
model | string | Yes | 模型名称 | |
status | string | Yes | 状态 | |
progress | string | Yes | 进度 | |
created_at | string | Yes | 创建时间 | |
seconds | string | Yes | 秒数 |
响应示例
成功
{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video.generation.job",
"model": "happy-horse-edit-720p",
"status": "queued",
"progress": 0,
"created_at": 1777355454
}