跳轉到主要內容
POST
從文字、參考圖片或起始影格建立 HappyHorse 影片。API 會立即傳回任務 ID。儲存傳回的 id,以輪詢任務並下載完成的影片。 POST /v1/videos 使用 multipart/form-data。將控制項作為表單欄位傳送,並將參考圖片作為 input_reference 欄位傳送,每個欄位包含一個 HTTPS URL 或上傳的圖片檔案。

選擇輸入模式

參考圖片可引導影片中的主體與視覺細節。傳送 1–9 個可公開存取的 HTTPS 圖片 URL 或 1–9 個圖片檔案,並依圖片順序為每張圖片重複傳送一次 input_reference。 在此欄位中僅使用 URL 或僅使用檔案。請分別傳送每個 URL,不要以逗號串接 URL。 對於 input_reference,每張參考圖片必須為 10 MB 以下,並符合 happyhorse-1.0。 使用 happyhorse-1.1 時,每張參考圖片必須為 20 MB 以下。 這些模型限制同時適用於圖片 URL 與上傳的檔案。 請使用最短邊至少為 400 px 的 JPEG、JPG、PNG 或 WEBP 圖片。 每個檔案的 input_reference 上傳限制為 20 MiB(20 × 1024 × 1024 位元組)。上傳的圖片也必須符合上述模型專屬限制。 本頁頂端的請求範例顯示 HappyHorse 1.1 的多個圖片 URL,以及兩個模型的多個檔案上傳。 若要設定起始影格,請傳送一次 first_frame,並提供一個可公開存取的 HTTPS 圖片 URL 或一個圖片檔案。請在與 input_reference 不同的請求中使用此欄位。

設定時長與尺寸

請從下表選擇一個確切的 WxH 值,以供 size 使用。 對於首幀請求,圖片會決定畫面構圖與長寬比,而 size 則選擇輸出解析度等級。

任務流程

1

建立任務

傳送 multipart 表單請求,並儲存傳回的 id。
2

輪詢任務

呼叫 取得 HappyHorse 影片 直到 status 為 completed、failed 或 error。
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 image inputs, describe the motion and visual details to preserve.

範例:

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

seconds
integer
預設值:5

Requested clip duration in whole seconds. Send an integer from 3 through 15 as a form field. The default is 5.

必填範圍: 3 <= x <= 15
範例:

3

size
string

Output size as an exact WxH value. Use one of the documented size values for the selected HappyHorse model. For first-frame requests, size selects the resolution tier; the image determines the framing and aspect ratio.

範例:

"1920x1080"

input_reference

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.

Pattern: ^https://
first_frame

Opening-frame image as one publicly accessible HTTPS URL or one image file. Send this field once, using either a URL or a file. Use JPEG, JPG, PNG, or WEBP images up to 20 MB. Do not combine first_frame with input_reference.

Pattern: ^https://

回應

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.

最後修改於 2026年9月9日