Kling Omni 画像タスクを作成
CometAPI POST /kling/v1/images/omni-image を使用して、プロンプトと参照画像の入力から Kling Omni Image タスクを作成します。
task_id が返されます。 Kling Omni 画像タスクを取得 を使用して、生成された画像 URL が利用可能になるまでタスクをポーリングします。
リクエスト形式を選択
- 単一画像生成:
prompt、image_list、resolution、result_type: single、n、およびaspect_ratioを送信します - 透かし付き出力: クエリレスポンスで透かし付き結果 URL が必要な場合は、
watermark_info.enabled: trueを追加します - モデル ID: ルートのデフォルトを使用するには
model_nameを省略するか、kling-image-o1やkling-v3-omniなど、テスト済みの Omni Image モデル ID を送信します
image_list の項目を使用し、各項目に image フィールドを含めます。プロンプトからはインデックスで参照でき、たとえば最初の項目には <<<image_1>>>、2 番目の項目には <<<image_2>>> を使用します。
タスクフロー
タスクを作成
POST /kling/v1/images/omni-image を送信し、返された data.task_id を保存します。タスクを照会
data.task_status が succeed または failed になるまでポーリングします。画像を永続保存
data.task_result.images[].url を自身のストレージにコピーします。結果フィールド
成功したクエリレスポンスでは、生成画像がdata.task_result.images に返されます。各項目には次の内容を含めることができます。
承認
Bearer token authentication. Use your CometAPI API key.
ヘッダー
Must be application/json.
ボディ
Text prompt for the generated image. The prompt can reference images with <<<image_1>>>, <<<image_2>>>, and matching indexes from image_list. Maximum length is 2,500 characters.
Optional model ID for this Omni Image request. Omit this field to use the route default.
Reference images that the prompt can cite with <<<image_1>>>, <<<image_2>>>, and so on. Keep the total number of reference images within the provider limits for the selected model.
Requested output resolution. Use 1k, 2k, or 4k; omitted requests use 1k.
1k, 2k, 4k Use single for a single-image task.
single Number of single-image results to generate. Range: 1 to 9.
1 <= x <= 9Requested output aspect ratio in width:height format. Use auto to let the provider choose from the prompt and references.
16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9, auto Watermark options. When enabled is true, the task can return watermarked result URLs in addition to the original result URLs.
Webhook URL that receives task status notifications when the task status changes. Omit this field to poll manually.
User-defined task ID for your own tracking. It does not replace the system-generated task_id and must be unique per account.