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.