Skip to main content
POST
cURL
複数の被写体参照画像に加えて、必要に応じてシーンまたはスタイル参照画像から Kling に 1 枚の画像を生成させたい場合は、このエンドポイントを使用します。

呼び出す前に

  • subject_image_list に 1 ~ 4 枚の画像を指定します
  • 新しいリクエストには model_name: kling-v2-1 を使用します
  • コアとなる被写体構図がすでに機能している場合にのみ scene_image または style_image を追加します
  • これは非同期生成ルートとして扱い、返された task id を保存します

タスクの流れ

1

画像生成タスクを送信

被写体画像のリストとプロンプトを送信し、返された task id を保存します。
2

タスクをポーリング

返されたタスクが終端状態に到達するまで、対応する Kling 画像クエリパスでポーリングします。
3

結果を永続化

永続的にアクセスする必要がある場合は、生成された画像を自分のストレージに保存します。
完全なパラメータリファレンスについては、公式の Kling ドキュメントを参照してください。

承認

Authorization
string
header
必須

Bearer token authentication. Use your CometAPI key.

ヘッダー

Content-Type
string
デフォルト:application/json

Must be application/json.

ボディ

application/json
subject_image_list
object[]
必須

Subject reference images. Minimum 1, maximum 4.

Required array length: 1 - 4 elements
model_name
enum<string>
デフォルト:kling-v2

Model to use for multi-image generation. Use kling-v2-1 for new requests; omitting the field uses the legacy route default.

利用可能なオプション:
kling-v2,
kling-v2-1
prompt
string

Text prompt describing the desired output. Maximum 2500 characters.

negative_prompt
string

Elements to exclude from the image. Maximum 2500 characters.

scene_image
string

Optional scene reference image. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

style_image
string

Optional style reference image. Image URL or raw Base64 string without a data: prefix. Supported formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.

n
integer
デフォルト:1

Number of images to generate. Range: 1-9.

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

Aspect ratio of the generated image.

利用可能なオプション:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9
watermark_info
object

Watermark options.

callback_url
string

Webhook URL for task status notifications.

external_task_id
string

Optional user-defined task ID for your own tracking. Must be unique per account.

レスポンス

200 - application/json

Task request accepted or an error response returned by the API.

code
必須

Response code. 0 means the task request was accepted.

message
string
必須

Response message.

data
object
必須
request_id
string

Request identifier returned when present.