Happy-Horse 视频生成
Happy-Horse 支持文生视频、图生视频、多参考图生视频和视频编辑。通过统一视频生成接口提交任务,再轮询任务 ID,直到返回结果视频 URL。
支持模型
| 模型 | 用途 |
|---|---|
happy-horse-720p | 720p 文生视频、图生视频和多参考图生成。 |
happy-horse-1080p | 1080p 文生视频、图生视频和多参考图生成。 |
happy-horse-edit-720p | 720p 视频编辑。 |
happy-horse-edit-1080p | 1080p 视频编辑。 |
Endpoint
POST /v1/video/generations
GET /v1/videos/{task_id}
Authentication
Authorization: Bearer sk-***
Content-Type: application/json
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | Happy-Horse 公共模型 ID。 |
prompt | string | 是 | 提示词。来源限制最多 2500 字符。 |
aspect_ratio | string | 否 | 16:9、9:16、1:1、4:3 或 3:4。 |
duration | integer | 条件必填 | 输出秒数,来源范围为 3 到 15。 |
seed | integer | 否 | 随机种子,范围 0 到 2147483647。 |
image | string | 条件必填 | 单张公开可访问的源图片 URL。 |
images | string[] | 条件必填 | 1 到 9 张公开可访问的参考图 URL。 |
video | string | 条件必填 | 编辑模型使用的源视频 URL。 |
reference_image_urls | string[] | 否 | 视频编辑参考图。 |
audio_setting | string | 否 | auto 或 origin;默认跟随上游配置。 |
文生视频示例
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
}'
图生视频示例
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
}'
多参考图示例
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
}'
视频编辑示例
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"
}'
查询任务状态
curl "{BASE_URL}/v1/videos/task_xxx" \
-H "Authorization: Bearer sk-***"
{
"id": "task_xxx",
"task_id": "task_xxx",
"object": "video.generation.job",
"model": "happy-horse-720p",
"status": "completed",
"progress": 100,
"video_url": "https://example.com/output.mp4"
}
建议每 2 到 5 秒轮询一次。status 为 completed 或 failed 时停止。
计费说明
Happy-Horse 计费与模型档位、输出分辨率、输出秒数和操作类型有关。视频编辑可能涉及源视频处理。最终价格以当前产品价格页和任务结算记录为准。
常见错误
- 编辑模型没有传
video。 duration不在3到15范围内。- 媒体 URL 私有、过期或上游不可访问。
- 参考图超过
9张。 - 使用 720p 模型却请求 1080p
size。