Skip to main content
POST
cURL
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 tùy chọn.

Trước khi gọi

  • Cung cấp từ 1 đến 4 ảnh trong subject_image_list
  • Sử dụng model_name: kling-v2-1 cho các request mới
  • Chỉ thêm scene_image hoặc style_image khi bố cục chủ thể cốt lõi đã hoạt động đúng
  • Xem đây là một tuyến tạo ảnh async 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ụ

Thăm dò tác vụ được trả về bằng đường dẫn truy vấn ảnh Kling tương ứng cho đến khi tác vụ đạt trạng thái kết thúc.
3

Lưu kết quả

Lưu ảnh được 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 khảo đầy đủ về tham số, 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
mặc định:application/json

Must be application/json.

Nội dung

application/json
subject_image_list
object[]
bắt buộc

Subject reference images. Minimum 1, maximum 4.

Required array length: 1 - 4 elements
model_name
enum<string>
mặc định:kling-v2

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

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

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

Phạm vi bắt buộc: 1 <= x <= 9
aspect_ratio
enum<string>
mặc định:16:9

Aspect ratio of the generated image.

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

Phản hồi

200 - application/json

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

code
bắt buộc

Response code. 0 means the task request was accepted.

message
string
bắt buộc

Response message.

data
object
bắt buộc
request_id
string

Request identifier returned when present.