跳轉到主要內容
POST
cURL
使用 POST /omni-video/{model} 建立非同步的 Kling Omni 影片任務。將模型 ID 放在 URL 中,並在 contents 中提供輸入。

選擇模型

  • kling-4.0: 720p 或 1080p;3–30 秒;不含 audio 欄位。除了固定的長寬比,也支援 adaptive 長寬比,並接受 middle_frame 內容。
  • kling-3.0-omni: 720p, 1080p,或 4k;3–15 秒;native、original 或 off 音訊。
  • kling-o1: 720p 或 1080p;3–10 秒;original 或 off 音訊。
純文字範例使用 kling-3.0-omni。若要建立無聲影片,請將 settings.audio 設為 off。

請求參數

對於 kling-4.0,最多允許一個 base_video 內容項目。對於 kling-3.0-omni,feature_video 輸入需要 settings.multi_shot: true 和 settings.audio: off。base_video 輸入需要 settings.multi_shot: false,且不能使用 settings.audio: native。請勿將 base_video 與首影格或末影格一起使用。 kling-3.0-omni 的官方預設值為 multi_shot: true;需要指定鏡頭模式時,請明確設定此欄位。對於 kling-o1,Prompt 最多可包含 2500 個字元。若請求只包含 first_frame,且沒有其他參考圖片或影片,請使用 5 秒或 10 秒的長度。 若要建立一段五秒的純文字影片,請將此請求主體傳送至 POST /omni-video/kling-3.0-omni:
回應會傳回非同步任務的 id:
將 data.id 值用於 取得 Kling 任務 ,直到任務完成。從任務的 outputs 陣列中取得完成的影片 URL。如果需要長期存取,請將影片儲存在自己的儲存空間中。 OpenAPI 面板包含對應的 Shell、Python 和 JavaScript 請求。如需更多輸入組合,請參閱 Kling 3.0 Omni 影片 API 參考 或 Kling O1 Omni 影片 API 參考.

授權

Authorization
string
header
必填

Authenticate with your CometAPI API key.

路徑參數

model
enum<string>
必填

Kling Omni model ID. The selected model controls resolution, duration, and audio choices. kling-4.0 adds the adaptive ratio and the middle_frame input role.

可用選項:
kling-4.0,
kling-3.0-omni,
kling-o1

主體

application/json

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

contents
object[]
必填

Video input items. Send a prompt item for text-only generation.

Minimum array length: 1
settings
object

Output settings exposed by the CometAPI route. Set model-specific fields explicitly for the intended result.

options
object

Optional task fields exposed by the CometAPI route.

回應

200 - application/json

Task created. Store data.id for a GET /tasks query.

code
必填

Result code. 0 indicates task creation.

message
string
必填

Result message.

data
object
必填

Task identification and submission status.

msg
string

Additional result message, when included.

最後修改於 2026年11月13日