跳轉到主要內容
POST
cURL
將來源圖片傳送至 POST /image-to-video/{model} 以建立影片任務。你可以加入 Prompt 來描述動作。回應包含用於擷取結果的 id。

選擇模型

在 URL 中指定模型 ID。請勿在 JSON 本文中加入模型欄位。 kling-4.0 接受 first_frame、middle_frame 和 last_frame;使用 last_frame 時,請加入 first_frame。kling-3.0-turbo 僅接受 first_frame。kling-2.5-turbo、 kling-3.0以及 kling-2.6 也支援 last_frame;使用時請加入 first_frame 與其搭配使用。對於 kling-2.5-turbo 和 kling-2.6, 的首尾影格組合需要 1080p。

請求參數

將每個輸入放入 contents。prompt 項目使用 text;影格項目使用 url。對於圖片,請提供可公開存取的 URL,或以 Base64 編碼的 JPG 或 PNG 資料。 kling-4.0 不提供 settings.audio 開關。其影片包含音軌;請省略此欄位,而非傳送模型會忽略的值。 以下請求將一張來源圖片製作成五秒的動畫影片:
使用其他圖片時,請將圖片 URL 替換為來源圖片的公開 URL,或以 Base64 編碼的 JPG/PNG 資料。使用您的 CometAPI API 金鑰,將此本文傳送至 https://api.cometapi.com/image-to-video/kling-3.0-turbo。OpenAPI 程式碼面板提供使用相同本文的 Shell、Python 和 JavaScript 請求。

擷取影片

建立請求的回應格式如下:
儲存 data.id。使用 取得 Kling 任務 查詢該 ID,直到任務達到終止狀態。從任務的 outputs 陣列中讀取影片 URL。

授權

Authorization
string
header
必填

Authenticate with your CometAPI API key.

路徑參數

model
enum<string>
預設值:kling-3.0-turbo
必填

Kling model ID. kling-4.0 accepts 3-30 second durations and middle_frame inputs. kling-3.0 supports 4k resolution. The 2.x models accept 5- or 10-second duration.

可用選項:
kling-4.0,
kling-3.0-turbo,
kling-3.0,
kling-2.6,
kling-2.5-turbo

主體

application/json

Image-to-video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.

contents
object[]
必填

Image and text inputs exposed by the CometAPI route. Include a first_frame image. Add a prompt entry or a model-supported last_frame image when needed.

Minimum array length: 1
settings
object

Video generation settings exposed by the CometAPI route. The model ID in the URL determines which values are accepted.

options
object

Optional task fields exposed by the CometAPI route.

回應

200 - application/json

The task was created. Use data.id to retrieve its status and video output.

code
必填

Request result code. 0 or success indicates acceptance.

message
string
必填

Result message.

data
object
必填

Task identifier and submission status.

msg
string

Additional result message when included in the response.

最後修改於 2026年11月13日