Kling の image-to-video タスクを作成する
CometAPI の POST /kling/v1/videos/image2video を介して、1 枚の画像を Kling 動画に変換します。非同期のタスク作成と、task ID による進捗追跡に対応しています。
呼び出す前に
- 公開された画像 URL を 1 つ、または base64 画像文字列を 1 つ指定します
- Kling のピクセル要件を満たす画像を使用してください。極端に小さいサムネイルは生成タスクで拒否されます
- まずはデフォルトの
kling-v2-6の例から始め、別のモデル系統が必要な場合は OpenAPI の enum から別のmodel_nameを選択してください - 最初のリクエストはシンプルにしてください: 入力画像 1 枚、プロンプト 1 つ、末尾フレームなし、motion masks なし
- 局所的な動きを制御したい場合は、
dynamic_masksを mask-and-trajectory オブジェクトの配列として使用します - 生成音声をサポートするモデル系統で、音声なしの決定的な初回リクエストにしたい場合は
sound: offを使用します
モデル命名
このエンドポイントでは通常の Kling 動画 model ID を使用します。Omni model ID は Omni Video 用にしてください。タスクの流れ
image-to-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