跳到主要内容

创建 Happy Horse 视频任务

本页示例中的 {BASE_URL} 表示 https://api.uniall.ai。

更新时间:2026-08-10

概览​

所有能力都使用唯一公共模型 happy-horse。通过 operation 选择文生、图生、多参考图或视频编辑,通过 resolution 选择输出档位。

不要使用已删除的旧档位模型名。旧名字与当前公共契约不兼容。

接口​

POST /v1/videos

兼容的创建路径:

POST /v1/videos/generations
POST /v1/video/generations

新接入建议使用 /v1/videos。

鉴权​

Authorization: Bearer sk-***
Content-Type: application/json

能力矩阵​

operation提示词图片输入视频输入分辨率durationaspect_ratio
text_to_video必填不接受不接受720p、1080p可选,默认 5可选,默认 16:9
image_to_video可选恰好 1 张不接受720p、1080p可选,默认 5不支持
reference_to_video必填1 至 9 张不接受720p、1080p可选,默认 5可选,默认 16:9
edit_video必填0 至 5 张恰好 1 个720p、1080p不支持不支持

请求体参数​

参数类型必填说明
modelstring是固定为 happy-horse。
operationstring是text_to_video、image_to_video、reference_to_video 或 edit_video。
resolutionstring是所有操作均支持 720p 或 1080p。
promptstring条件必填除 image_to_video 外均必填,最长 2500 字符。
durationinteger否仅生成使用,范围 3 至 15,默认 5;编辑请求不能传。
aspect_ratiostring否仅文生和多参考图生视频使用;图生和编辑请求不能传。
imagestring条件必填image_to_video 推荐使用的单张 HTTP(S) 图片字段。
imagesstring[]条件必填reference_to_video 使用的 1 至 9 张 HTTP(S) 图片。
reference_image_urlsstring[]否多参考图的别名;视频编辑也可使用,最多 5 张。
videostring条件必填edit_video 使用的单个 HTTP(S) 源视频。
seedinteger否随机种子,范围 0 至 2147483647。
watermarkboolean否是否添加水印,默认 false。
audio_settingstring否仅编辑使用:auto 或 origin,默认 auto。

文生和多参考图生视频支持以下 aspect_ratio:

  • 16:9
  • 9:16
  • 1:1
  • 4:3
  • 3:4
  • 4:5
  • 5:4
  • 9:21
  • 21:9

size 和 enable_safety_checker 不属于 Happy Horse 公共参数,传入会被拒绝。

公共 HappyHorse 1.0 契约不开放 480p。把 resolution 设为 480p 的请求会在 任务创建前被拒绝。

输入规则​

模式可用素材字段
文生视频不传图片或视频字段
图生视频使用 image,或通过受支持的图片别名传入恰好 1 张图片
多参考图生视频使用 images 或 reference_image_urls,传入 1 至 9 个 URL
视频编辑使用 video,并可选传入最多 5 个 reference_image_urls

所有媒体输入都必须是完整、可公开访问的 HTTP 或 HTTPS URL。当前模型契约不接受文件上传、裸 Base64 或 Data URL。

请求示例​

文生视频​

curl -X POST "{BASE_URL}/v1/videos" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse",
"operation": "text_to_video",
"resolution": "1080p",
"prompt": "A white horse runs across a misty grassland at sunrise, realistic movement and soft rim light.",
"duration": 7,
"aspect_ratio": "21:9",
"seed": 12345,
"watermark": false
}'

图生视频​

输出构图跟随源图片,因此不要传 aspect_ratio。

curl -X POST "{BASE_URL}/v1/videos" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse",
"operation": "image_to_video",
"resolution": "720p",
"image": "https://example.com/source-frame.png",
"prompt": "The subject walks forward naturally while the camera slowly pushes in.",
"duration": 5,
"seed": 67890,
"watermark": false
}'

image_to_video 可以省略提示词。

多参考图生视频​

提示词可以使用 character1 至 character9,按数组顺序指代参考图。

curl -X POST "{BASE_URL}/v1/videos" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse",
"operation": "reference_to_video",
"resolution": "720p",
"prompt": "character1 drives character2 across the lunar surface while both identities remain consistent.",
"reference_image_urls": [
"https://example.com/character.png",
"https://example.com/vehicle.png"
],
"duration": 8,
"aspect_ratio": "16:9",
"seed": 24680,
"watermark": false
}'

视频编辑​

编辑时长跟随源视频,不能传 duration 或 aspect_ratio。

curl -X POST "{BASE_URL}/v1/videos" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{
"model": "happy-horse",
"operation": "edit_video",
"resolution": "1080p",
"prompt": "Replace the jacket with the referenced red jacket while preserving identity, motion, camera movement, and background.",
"video": "https://example.com/source-video.mp4",
"reference_image_urls": [
"https://example.com/red-jacket.png"
],
"audio_setting": "origin",
"seed": 13579,
"watermark": false
}'

使用 audio_setting: "origin" 保留原音频;使用 auto 让服务自动决定音频处理方式。

extra_body 兼容​

推荐把公共参数直接放在请求体顶层。兼容客户端也可以把 operation、resolution、seed、watermark 和 audio_setting 放入 extra_body。不要在顶层和 extra_body 中传入互相冲突的值。

{
"model": "happy-horse",
"prompt": "Turn the room into a warm wooden studio.",
"video": "https://example.com/source-video.mp4",
"extra_body": {
"operation": "edit_video",
"resolution": "720p",
"audio_setting": "auto",
"watermark": false
}
}

响应示例​

任务已受理​

{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video.generation.job",
"model": "happy-horse",
"status": "queued",
"progress": 0,
"created_at": 1785801600,
"video_url": null
}

任务状态与结果​

创建成功后保存 id 或 task_id,随后调用 GET /v1/videos/{task_id},直到任务进入 completed 或 failed。统一的轮询间隔、状态字段、错误结构、结果地址和鉴权下载方式见视频生成概览。

视频编辑等最终结算操作应在任务完成后再次读取 billing_contract。

素材限制​

图生视频源图片​

  • 格式:JPEG、JPG、PNG、BMP 或 WebP。
  • 最小尺寸:300px。
  • 画面比例:1:2.5 至 2.5:1。
  • 最大文件:10MB。

多参考图​

  • 格式:JPEG、JPG、PNG 或 WebP。
  • 数量:1 至 9 张。
  • 最短边至少 400px,建议 720p 以上。
  • 每张最大 10MB。

视频编辑源素材​

  • 格式:MP4 或 MOV,推荐 H.264。
  • 输入时长:3 至 60 秒;编辑服务最多处理 15 秒。
  • 尺寸:长边不超过 2160px,短边不小于 320px。
  • 画面比例:1:2.5 至 2.5:1。
  • 帧率:大于 8fps。
  • 最大文件:100MB。

编辑参考图支持 JPEG、JPG、PNG 或 WebP,尺寸至少 300px,每张最大 10MB。

计费说明​

  • 文生、图生和多参考图生成按请求的输出时长与分辨率档位结算。
  • 视频编辑根据实际输入和输出视频时长进行最终结算,最终费用可能与提交时预估不同。
  • resolution 是服务档位,不保证每种画幅或源图片都对应一个固定像素尺寸。
  • 最终金额以 UniAll 当前价格页和任务结算记录为准。

常见错误​

错误原因处理方式
模型名无效使用了已删除的旧档位模型名把 model 改为 happy-horse
缺少参数未传 operation 或 resolution显式传入两个参数
参数不支持传入了 size 或 enable_safety_checker删除不支持的字段
素材数量不正确当前操作收到错误数量的图片或视频按能力矩阵调整素材
分辨率不正确resolution 为 480p 或其他不支持的值使用 720p 或 1080p
编辑参数不正确编辑请求包含 duration 或 aspect_ratio删除不支持字段
素材下载失败URL 私有、过期、重定向异常或无法访问使用稳定的公开 HTTPS URL

相关页面​