跳到主要内容
AI
MarkdownLLMs.txt

创建视频生成任务

本文档说明 Happy Horse 视频模型调用方式。

公共模型

公共模型能力分辨率档位
happy-horse-720p文生视频、图生视频、参考图生视频720p
happy-horse-1080p文生视频、图生视频、参考图生视频1080p
happy-horse-edit-720p视频编辑720p
happy-horse-edit-1080p视频编辑1080p

说明:

  • duration 对所有 Happy Horse 公共模型都是必传参数,允许 315 秒。
  • 对视频编辑模型,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>

参数说明

参数类型必填适用模型说明
modelstring全部公共模型名
promptstring全部提示词,最多 2500 字符
durationinteger全部允许 315 秒;编辑模型仅用于外围计费
sizestring全部可选传同档位值:720p 模型传 720p,1080p 模型传 1080p
seedinteger全部随机种子,范围按 02147483647
aspect_ratiostring文生视频、参考图生视频可选 16:99:161:14:33:4
imagestring图生视频必填图生视频单张源图片 URL
imagesstring[]参考图生视频必填参考图生视频1 到 9 张参考图片 URL
reference_image_urlsstring[]参考图生视频可用参考图生视频images 的等价别名

图片约束:

  • 图生视频 image 支持 jpegjpgpngbmpwebp,图片尺寸至少 300px,比例在 1:2.52.5:1,最大 10MB
  • 参考图生视频 images 支持 jpegjpgpngwebp,1 到 9 张,最短边至少 400px,建议 720p 以上,单张最大 10MB
  • 参考图生视频提示词中应使用 character1character9 指代图片角色。

视频编辑参数

参数类型必填说明
videostring输入视频 URL
reference_image_urlsstring[]参考图片 URL,最多 5 张
audio_settingstring可选 autoorigin,默认使用上游默认 auto

输入视频约束:

  • 支持 mp4mov,推荐 H.264。
  • 输入视频时长 360 秒。
  • 长边不超过 2160px,短边不小于 320px
  • 画面比例在 1:2.52.5:1
  • 帧率大于 8fps,文件最大 100MB

参考图片约束:

  • 最多 5 张。
  • 支持 jpegjpgpngwebp
  • 尺寸至少 300px,比例在 1:2.52.5:1
  • 单张最大 10MB

接口参数与示例

Endpoint

POST /v1/video/generations

Header 参数

NameTypeRequiredDescriptionExample
AuthorizationstringNoBearer {your_token}

请求体参数

FieldTypeRequiredTitleDescription
modelstringYes模型名称公共模型名
promptstringYes提示词提示词,最多 2500 字符
imagestringYes参考图URL单张源图片 URL,必须是公开可访问的URL图片链接
imagesstringYes参考图生视频1 到 9 张参考图片 URL
aspect_ratiostringNo画幅比例可选 16:99:161:14:33:4
durationstringNo输出描述允许 315 秒;编辑模型仅用于外围计费
seedstringYes随机种子随机种子,范围按 02147483647
videostringYes输入视频URL必须是公开可访问的URL媒体链接
audio_settingstringYes可选 autoorigin,默认使用上游默认 auto
sizestringNoExample fieldAppears in a request example; no separate field description is provided.
reference_image_urlsarrayNoExample fieldAppears 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
}'

响应字段

FieldTypeRequiredTitleDescription
idstringYes任务ID
objectstringYes任务类型
modelstringYes模型名称
statusstringYes状态
progressstringYes进度
created_atstringYes创建时间
secondsstringYes秒数

响应示例

成功

{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video.generation.job",
"model": "happy-horse-edit-720p",
"status": "queued",
"progress": 0,
"created_at": 1777355454
}