建立 Kling 圖生影片任務
透過 CometAPI POST /kling/v1/videos/image2video,將單張圖片轉換為 Kling 影片,並支援非同步任務建立與依 task ID 追蹤進度。
呼叫前準備
- 提供一個公開圖片 URL 或一個 base64 圖片字串
- 使用符合 Kling 像素要求的圖片;過小的縮圖會被生成任務拒絕
- 先從預設的
kling-v2-6範例開始,當你需要不同模型路線時,再從 OpenAPI enum 中選擇其他model_name - 保持第一次請求簡單:一張輸入圖片、一個 prompt、無尾幀、無動作遮罩
- 當你需要可控的局部動作時,使用
dynamic_masks作為由遮罩與軌跡物件組成的陣列 - 對於支援生成聲音的模型路線,第一個請求可使用
sound: off來實現可重現且無音訊的結果
模型命名
在此端點上請使用一般的 Kling 影片 model ID。Omni model ID 請保留給 Omni Video。任務流程
提交圖生影片請求
task_id。輪詢任務
儲存結果
授權
Bearer token authentication. Use your CometAPI key.
主體
Source image URL or base64 image string. Use an image that meets Kling pixel requirements; very small thumbnails are rejected. For base64 input, send the encoded image string as the field value.
Text prompt describing the desired motion. Maximum 500 characters.
Elements to exclude from the video. Maximum 200 characters.
Webhook URL to receive task status updates when the task completes.
Generation mode. std for standard (faster), pro for professional (higher quality).
std, pro Model ID for this image-to-video request. Use kling-v3 for new requests. Use Omni model IDs only with the Omni Video endpoint.
kling-v1, kling-v1-5, kling-v1-6, kling-v2-master, kling-v2-1, kling-v2-1-master, kling-v2-5-turbo, kling-v2-6, kling-v3 Tail-frame reference image as a Base64 string or public URL. Same format requirements as image. Controls the last frame of the generated video.
Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.
Output video length in seconds. Use 5 or 10; omit to use 5.
Static brush mask image as a Base64 string or public URL. White areas are frozen in place during video generation. Must match the aspect ratio and resolution of the input image.
Optional motion masks. Each entry contains a mask image and an ordered trajectory list.
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.
Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.
on, off