跳轉到主要內容
POST
cURL
將 Prompt 傳送至 POST /text-to-video/{model} 以建立影片任務。回應包含可用來取得結果的 id。

選擇模型

將模型 ID 放入 URL。請勿在 JSON 請求本文中新增模型欄位。

請求參數

kling-4.0 不提供 settings.audio 開關。其影片包含音軌;請省略該欄位,而非傳送模型會忽略的值。 以下請求使用 kling-3.0-turbo 建立一段五秒的影片:
使用您的 CometAPI API 金鑰,將此本文傳送至 https://api.cometapi.com/text-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 the 21:9 ratio. 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

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

prompt
string
必填

Text description of the video to generate.

Minimum string 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日