跳轉到主要內容
POST
/
kling
/
v1
/
images
/
generations
Multi-Image to Image
curl --request POST \
  --url https://api.cometapi.com/kling/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subject_image_list": [
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    },
    {
      "subject_image": "https://filesystem.site/cdn/20250814/goDW44JIf6eSuxAS7TNringhWjO9kW.png"
    }
  ]
}
'
{
  "code": 123,
  "message": "<string>",
  "request_id": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  }
}
當你希望 Kling 根據多個主體參考圖,再加上可選的場景或風格參考圖,生成一張圖片時,請使用此端點。

呼叫前須知

  • subject_image_list 中提供 2 到 4 張圖片
  • 使用 model_name: kling-v2
  • 僅在核心主體構圖已經可用時,才加入 scence_imagestyle_image
  • 將此視為非同步生成路由,並保存回傳的 task id

任務流程

1

提交圖片生成任務

傳送主體圖片清單與 prompt,然後儲存回傳的 task id。
2

輪詢任務

透過 Kling 圖片查詢路徑繼續使用單筆查詢,直到任務進入最終狀態。
3

保存結果

如果你需要持久存取,請將生成的圖片保存到你自己的儲存空間中。
如需完整的參數參考,請參閱官方 Kling 文件

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

標頭

Content-Type
string

Content type of the request body.

主體

application/json

Kling Image Generation API request body definition

subject_image_list
object[]
必填

List of subject reference images. Minimum 2, maximum 4.

model_name
enum<string>
預設值:kling-v2

Model to use for multi-image generation.

可用選項:
kling-v2
prompt
string

Text prompt describing the desired output. Max 2500 characters.

scence_image
string

Optional scene reference image. Same format and size constraints as subject images.

style_image
string

Optional style reference image. Same format and size constraints as subject images.

n
integer
預設值:1

Number of images to generate.

aspect_ratio
enum<string>
預設值:16:9

Aspect ratio of the generated image (width:height).

可用選項:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9
callback_url
string

Webhook URL for task status notifications. The server sends a callback when the task status changes.

external_task_id
string

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

回應

200 - application/json

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object