Chuyển đến nội dung chính
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
  }
}
Sử dụng endpoint này khi bạn muốn Kling tạo một ảnh từ nhiều ảnh tham chiếu chủ thể cùng với các ảnh tham chiếu cảnh hoặc phong cách không bắt buộc.

Trước khi gọi

  • Cung cấp từ 2 đến 4 ảnh trong subject_image_list
  • Sử dụng model_name: kling-v2
  • Chỉ thêm scence_image hoặc style_image khi bố cục chủ thể cốt lõi đã hoạt động tốt
  • Xem đây là một route tạo ảnh bất đồng bộ và lưu task id được trả về

Luồng tác vụ

1

Gửi tác vụ tạo ảnh

Gửi danh sách ảnh chủ thể và prompt, sau đó lưu task id được trả về.
2

Thăm dò tác vụ

Tiếp tục với Truy vấn riêng lẻ bằng đường dẫn truy vấn ảnh Kling cho đến khi tác vụ đạt trạng thái kết thúc.
3

Lưu kết quả

Lưu ảnh đã tạo vào hệ thống lưu trữ của riêng bạn nếu bạn cần truy cập lâu dài.
Để xem tài liệu tham chiếu tham số đầy đủ, hãy xem tài liệu Kling chính thức.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Tiêu đề

Content-Type
string

Content type of the request body.

Nội dung

application/json

Kling Image Generation API request body definition

subject_image_list
object[]
bắt buộc

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

model_name
enum<string>
mặc định:kling-v2

Model to use for multi-image generation.

Tùy chọn có sẵn:
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
mặc định:1

Number of images to generate.

aspect_ratio
enum<string>
mặc định:16:9

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

Tùy chọn có sẵn:
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.

Phản hồi

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