Przejdź do głównej treści
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
  }
}
Użyj tego endpointu, gdy chcesz, aby Kling wygenerował jeden obraz na podstawie wielu referencji obiektu oraz opcjonalnych referencji sceny lub stylu.

Zanim go wywołasz

  • Podaj od 2 do 4 obrazów w subject_image_list
  • Użyj model_name: kling-v2
  • Dodawaj scence_image lub style_image tylko wtedy, gdy podstawowa kompozycja obiektu już działa poprawnie
  • Traktuj to jako asynchroniczną ścieżkę generowania i zapisz zwrócone id zadania

Przepływ zadania

1

Prześlij zadanie generowania obrazu

Wyślij listę obrazów obiektu i prompt, a następnie zapisz zwrócone id zadania.
2

Sprawdzaj status zadania

Kontynuuj w Individual Queries, używając ścieżki zapytania obrazu Kling, aż zadanie osiągnie stan końcowy.
3

Zapisz wynik

Zapisz wygenerowany obraz we własnym magazynie danych, jeśli potrzebujesz trwałego dostępu.
Pełne informacje o parametrach znajdziesz w oficjalnej dokumentacji Kling.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI key.

Nagłówki

Content-Type
string

Content type of the request body.

Treść

application/json

Kling Image Generation API request body definition

subject_image_list
object[]
wymagane

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

model_name
enum<string>
domyślnie:kling-v2

Model to use for multi-image generation.

Dostępne opcje:
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
domyślnie:1

Number of images to generate.

aspect_ratio
enum<string>
domyślnie:16:9

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

Dostępne opcje:
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.

Odpowiedź

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