Skip to main content
POST
cURL
このエンドポイントを使用すると、CometAPI 経由で非同期の Kling Omni Image タスクを作成できます。作成リクエストは task_id を返します。生成された画像 URL が利用可能になるまで、Kling Omni 画像タスクを取得する を使ってタスクをポーリングしてください。
プロバイダーの完全なパラメータリファレンスについては、Kling Image O1 documentation を参照してください。

リクエスト形式を選ぶ

  • 単一画像生成: prompt, image_list, resolution, result_type: single, n, aspect_ratio を送信します
  • 透かし付き出力: クエリレスポンスで透かし付き結果 URL が必要な場合は、watermark_info.enabled: true を追加します
  • Model ID: デフォルトのルートを使うには model_name を省略するか、kling-image-o1kling-v3-omni など検証済みの Omni Image model ID を送信します
参照画像は、image フィールドを持つ image_list の各項目を使用します。プロンプトではインデックスでそれらを参照でき、たとえば最初の項目には <<<image_1>>>、2 番目の項目には <<<image_2>>> を使います。

タスクの流れ

1

タスクを作成する

POST /kling/v1/images/omni-image を送信し、返された data.task_id を保存します。
2

タスクを照会する

data.task_statussucceed または failed になるまで、GET /kling/v1/images/omni-image/ をポーリングします。
3

画像を保存する

タスクが成功したら、永続的なアクセスが必要な場合は data.task_result.images[].url を自分のストレージにコピーします。
完全なレスポンススキーマとポーリング例については、Kling Omni 画像タスクを取得する を参照してください。次の短い例では、1 つのタスクが終端状態に達するまでポーリングします。

結果フィールド

成功したクエリレスポンスは、生成された画像を data.task_result.images に返します。各項目には次のものが含まれる場合があります。 生成アセットの URL は期限切れになるか、プロバイダーサービスによって削除されることがあります。ワークフローで長期保持が必要な場合は、完成した画像を自分のストレージレイヤーに保存してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI API key.

ヘッダー

Content-Type
string

Must be application/json.

ボディ

application/json
prompt
string
必須

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.

model_name
string

Optional model ID for this Omni Image request. Omit this field to use the route default.

image_list
object[]

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.

resolution
enum<string>
デフォルト:1k

Requested output resolution. Use 1k, 2k, or 4k; omitted requests use 1k.

利用可能なオプション:
1k,
2k,
4k
result_type
enum<string>
デフォルト:single

Use single for a single-image task.

利用可能なオプション:
single
n
integer
デフォルト:1

Number of single-image results to generate. Range: 1 to 9.

必須範囲: 1 <= x <= 9
aspect_ratio
enum<string>
デフォルト:auto

Requested 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_info
object

Watermark options. When enabled is true, the task can return watermarked result URLs in addition to the original result URLs.

callback_url
string<uri>

Webhook URL that receives task status notifications when the task status changes. Omit this field to poll manually.

external_task_id
string

User-defined task ID for your own tracking. It does not replace the system-generated task_id and must be unique per account.

レスポンス

200 - application/json

Task accepted.

code
integer
必須

Response code. 0 means the task request was accepted.

message
string
必須

Response message.

data
object
必須
request_id
string

Request identifier returned by CometAPI when present.