创建 HappyHorse 视频
通过 CometAPI 使用 POST /v1/videos 创建 HappyHorse 文生视频或参考图生视频任务,然后轮询任务并下载完成的 MP4 文件。
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=happyhorse-1.1 \
-F 'prompt=A close-up cinematic shot of a ceramic coffee cup on a wooden table. Steam rises slowly while morning light moves across the background.' \
-F seconds=3 \
-F size=1920x1080{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "happyhorse-1.1",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}id,以便轮询任务并下载完成的视频。
POST /v1/videos 使用 multipart/form-data。将控制参数作为表单字段发送,并将参考图像作为 input_reference 字段发送,每个字段对应一个 HTTPS URL 或上传的图像文件。
选择输入模式
| 目标 | 模型 | 必填字段 | 可选字段 |
|---|---|---|---|
| 文生视频 | happyhorse-1.0, happyhorse-1.1 | model, prompt | seconds, size |
| 参考图生视频 | happyhorse-1.0, happyhorse-1.1 | model, prompt, 1–9 input_reference URL 或文件 | seconds, size |
| 首帧图生视频 | happyhorse-1.0, happyhorse-1.1 | model, prompt,一个 first_frame URL 或文件 | seconds, size |
input_reference。
在此字段中只能使用 URL 或只能使用文件。请分别发送每个 URL,而不是用逗号连接多个 URL。
对于 input_reference,每张参考图像必须不超过 10 MB,且需满足 happyhorse-1.0。
使用 happyhorse-1.1 时,每张参考图像必须不超过 20 MB。
这些模型限制同时适用于图像 URL 和上传的文件。
请使用 JPEG、JPG、PNG 或 WEBP 图像,且最短边至少为 400 px。
每个文件的 input_reference 上传限制为 20 MiB(20 × 1024 × 1024 字节)。上传的图像还必须满足上述模型专属限制。
本页顶部的请求示例展示了 HappyHorse 1.1 的多个图像 URL,以及两个模型的多个文件上传。
要设置首帧,请使用一个可公开访问的 HTTPS 图像 URL 或一个图像文件发送一次 first_frame。请在与 input_reference 分开的请求中使用此字段。
设置时长和尺寸
| 模型 ID | seconds | 默认值 |
|---|---|---|
happyhorse-1.0 | 整数 3-15 | 5 秒, 1920x1080 |
happyhorse-1.1 | 整数 3-15 | 5 秒, 1920x1080 |
WxH 选择一个精确的 size 值。
对于首帧请求,图像决定画面构图和宽高比,而 size 用于选择输出分辨率级别。
| 模型 | 画面形状 | size 取值 |
|---|---|---|
happyhorse-1.0 | 横向 | 1280x720, 1920x1080 |
| 纵向 | 720x1280, 1080x1920 | |
| 方形 | 1440x1440 | |
happyhorse-1.1 | 横向 | 1280x720, 1920x1080 |
| 纵向 | 720x1280, 1080x1920 | |
| 方形 | 1440x1440 | |
| 经典横向 | 1440x1080 | |
| 经典纵向 | 720x960, 1080x1440 | |
| 宽幅横向 | 2520x1080 | |
| 宽幅纵向 | 1080x2520 | |
| 近方形横向 | 900x720, 1350x1080 | |
| 近方形纵向 | 720x900, 1080x1350 |
任务流程
创建任务
id。轮询任务
status 为 completed、failed 或 error。下载结果
completed 时,调用 获取 HappyHorse 视频内容 以下载 MP4 文件。请求体
Reference images for reference-to-video. Send 1–9 publicly accessible HTTPS image URLs or 1–9 uploaded image files by repeating input_reference once per image. Use only URLs or only files within this field; do not join URLs with commas. Reference images guide subjects and visual details. CometAPI preserves image order. Use JPEG, JPG, PNG, or WEBP images with a shortest side of at least 400 px. Each reference image must be at or below 10 MB for happyhorse-1.0 or 20 MB for happyhorse-1.1. These model limits apply to both image URLs and uploaded files. The input_reference file upload limit is 20 MiB (20 x 1024 x 1024 bytes) per file. Keep uploads within the model limit as well. Keep this field separate from first_frame.
^https://响应
Task created. Store the returned id and poll GET /v1/videos/{task_id}.
curl https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
-F model=happyhorse-1.1 \
-F 'prompt=A close-up cinematic shot of a ceramic coffee cup on a wooden table. Steam rises slowly while morning light moves across the background.' \
-F seconds=3 \
-F size=1920x1080{
"id": "task_example",
"task_id": "task_example",
"object": "video",
"model": "happyhorse-1.1",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}