Skip to main content
POST
Sử dụng endpoint này để tạo một tác vụ video HappyHorse. API trả về task ID ngay lập tức, vì vậy hãy lưu id được trả về và thăm dò tác vụ cho đến khi nó đạt trạng thái kết thúc. POST /v1/videos sử dụng multipart/form-data; truyền các tham số điều khiển dạng vô hướng dưới dạng form field và các ảnh tham chiếu dưới dạng file field input_reference.

Chọn một chế độ đầu vào

Đối với chế độ từ ảnh tham chiếu sang video, hãy tải lên 1-9 ảnh tham chiếu bằng cách lặp lại trường multipart input_reference. CometAPI gửi từng tệp được tải lên dưới dạng ảnh tham chiếu HappyHorse. Sử dụng ảnh JPEG, JPG, PNG hoặc WEBP có dung lượng tối đa 20 MB mỗi ảnh; để có kết quả tốt hơn, hãy dùng ảnh có cạnh ngắn nhất ít nhất 400 px.

Đặt thời lượng và kích thước

Đặt size thành giá trị WxH chính xác.

Quy trình tác vụ

1

Tạo tác vụ

Gửi yêu cầu form multipart và lưu id được trả về.
2

Thăm dò tác vụ

Gọi Truy xuất video HappyHorse cho đến khi statuscompleted, failed, hoặc error.
3

Tải xuống kết quả

Khi tác vụ là completed, hãy gọi Truy xuất nội dung video HappyHorse để tải xuống tệp MP4.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer authentication. Use your CometAPI API key.

Nội dung

multipart/form-data
model
enum<string>
bắt buộc

HappyHorse model ID for this endpoint.

Tùy chọn có sẵn:
happyhorse-1.0,
happyhorse-1.1
Ví dụ:

"happyhorse-1.1"

prompt
string
bắt buộc

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

Ví dụ:

"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.

Ví dụ:

"3"

size
string

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

Ví dụ:

"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.

Phản hồi

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

id
string
bắt buộc

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

Ví dụ:

"task_example"

object
string
bắt buộc

Object type. Video tasks return video.

Ví dụ:

"video"

model
string
bắt buộc

Model ID used for the task.

Ví dụ:

"happyhorse-1.1"

status
enum<string>
bắt buộc

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

Tùy chọn có sẵn:
queued,
in_progress,
completed,
failed,
error
Ví dụ:

"queued"

progress
integer
bắt buộc

Task progress as a coarse percentage.

Phạm vi bắt buộc: 0 <= x <= 100
Ví dụ:

0

created_at
integer
bắt buộc

Task creation time as a Unix timestamp in seconds.

Ví dụ:

1779938152

task_id
string

Compatibility alias for id when present.

Ví dụ:

"task_example"

completed_at
integer

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

Ví dụ:

1779938219

video_url
string

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

Ví dụ:

"<temporary-video-url>"

error
object

Failure details. This field appears when the task fails.