Skip to main content
POST
使用此端点创建 HappyHorse 视频任务。API 会立即返回任务 ID,因此请保存返回的 id,并轮询任务直到其达到终态状态。 POST /v1/videos 使用 multipart/form-data;将标量控制项作为表单字段传递,将参考图像作为 input_reference 文件字段传递。

选择输入模式

对于参考图生成视频,可通过重复 input_reference multipart 字段上传 1-9 张参考图像。CometAPI 会将每个上传的文件作为一张 HappyHorse 参考图像发送。请使用 JPEG、JPG、PNG 或 WEBP 格式的图像,每张最大 20 MB;为获得最佳效果,建议使用最短边至少为 400 px 的图像。

设置时长和尺寸

size 设置为精确的 WxH 值。

任务流程

1

创建任务

发送 multipart 表单请求,并保存返回的 id
2

轮询任务

调用 获取 HappyHorse 视频,直到 statuscompletedfailederror
3

下载结果

当任务为 completed 时,调用 获取 HappyHorse 视频内容 下载 MP4 文件。

授权

Authorization
string
header
必填

Bearer authentication. Use your CometAPI API key.

请求体

multipart/form-data
model
enum<string>
必填

HappyHorse model ID for this endpoint.

可用选项:
happyhorse-1.0,
happyhorse-1.1
示例:

"happyhorse-1.1"

prompt
string
必填

Text prompt that describes the video to generate. For reference-image requests, combine the prompt with the uploaded reference image.

示例:

"Use the uploaded reference image as the visual guide. Create a short cinematic shot with gentle natural motion."

seconds
string

Requested clip duration in seconds. Use an integer from 3 through 15. Default is 5.

示例:

"3"

size
string

Output size as an exact WxH value. Use one of the documented size values for the selected HappyHorse model.

示例:

"1920x1080"

input_reference
file

Reference image file for reference-to-video. Required when using reference-to-video; repeat this multipart field to send additional reference images. CometAPI preserves upload order. Use JPEG, JPG, PNG, or WEBP images up to 20 MB each.

响应

Task created. Store the returned id and poll GET /v1/videos/{task_id}.

id
string
必填

Task ID. Use this value with retrieve and content endpoints.

示例:

"task_example"

object
string
必填

Object type. Video tasks return video.

示例:

"video"

model
string
必填

Model ID used for the task.

示例:

"happyhorse-1.1"

status
enum<string>
必填

Task lifecycle status. Poll until the value is completed, failed, or error.

可用选项:
queued,
in_progress,
completed,
failed,
error
示例:

"queued"

progress
integer
必填

Task progress as a coarse percentage.

必填范围: 0 <= x <= 100
示例:

0

created_at
integer
必填

Task creation time as a Unix timestamp in seconds.

示例:

1779938152

task_id
string

Compatibility alias for id when present.

示例:

"task_example"

completed_at
integer

Task completion time as a Unix timestamp in seconds. This field appears on completed tasks.

示例:

1779938219

video_url
string

Temporary video delivery URL. This field appears on completed tasks.

示例:

"<temporary-video-url>"

error
object

Failure details. This field appears when the task fails.