Skip to main content
POST
cURL
使用這個端點可根據 Prompt 建立一個 Kling 文字轉影片任務。它會啟動非同步工作,而不是立即回傳完成的影片。

第一個可運作的請求

  • 先傳送簡短的 Prompt
  • 先從 kling-v3 範例開始,之後在需要不同模型路線時,再從 OpenAPI enum 中選擇其他 model_name
  • 只有在基本流程可正常運作後,再加入 aspect_ratiodurationmodesound
  • 如果你想使用推送交付而非純輪詢,請設定 callback_url
  • 當你希望第一次請求是可預測的無音訊結果,且模型支援生成音效時,請使用 sound: off

模型命名

在這個端點上請使用一般的 Kling 影片 model ID。Omni 模型的 model ID 請保留給 Omni Video

時長與長寬比

此端點不提供獨立的解析度 token 或精確的 size 欄位。請求的長寬比會控制輸出影格的形狀。

任務流程

1

提交生成請求

透過此端點建立任務,並儲存回傳的 Kling task id。
2

輪詢任務狀態

透過 取得 Kling 任務 檢查進度,直到任務進入最終狀態。
3

保存結果

一旦 Kling 回傳完成資產的中繼資料,如果你需要長期保存,請將結果移轉到你自己的儲存空間。
如需完整的參數矩陣與模型路線詳細資訊,請參閱 Kling 官方文件

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

標頭

Content-Type
string

Must be application/json.

主體

application/json
prompt
string
必填

Text prompt describing the video to generate. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

aspect_ratio
enum<string>

Aspect ratio request. Typical rendered sizes are 1280x720 for 16:9, 720x1280 for 9:16, and 960x960 for 1:1. This endpoint does not expose an exact size field.

可用選項:
16:9,
9:16,
1:1
callback_url
string

Webhook URL to receive task status updates when the task completes.

model_name
enum<string>
預設值:kling-v1

Model ID for this text-to-video request. Use an ordinary Kling video model ID; use Omni model IDs only with the Omni Video endpoint.

可用選項:
kling-v1,
kling-v1-6,
kling-v2-master,
kling-v2-1-master,
kling-v2-5-turbo,
kling-v2-6,
kling-v3
cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

mode
enum<string>
預設值:std

Generation mode. std for standard (faster), pro for professional (higher quality). The default is std.

可用選項:
std,
pro
duration
string
預設值:5

Output video length in seconds. Use 5 or 10; omit to use 5.

camera_control
object

Camera motion preset or manual configuration. Omit for automatic camera movement.

external_task_id
string

Custom task id for your own tracking. Does not replace the system-generated task id but can be used to query tasks. Must be unique per user.

sound
enum<string>

Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.

可用選項:
on,
off

回應

200 - application/json

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object