跳转到主要内容
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
  • 将其视为异步生成路由,并保存返回的任务 id

任务流程

1

提交图像生成任务

发送主体图像列表和 prompt,然后保存返回的任务 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