Skip to main content
POST
cURL
Użyj tego endpointu, gdy chcesz, aby Kling wygenerował jeden obraz na podstawie wielu referencji obiektu oraz opcjonalnych referencji sceny lub stylu.

Przed wywołaniem

  • Podaj od 1 do 4 obrazów w subject_image_list
  • Użyj model_name: kling-v2-1 dla nowych żądań
  • Dodawaj scene_image lub style_image tylko wtedy, gdy podstawowa kompozycja obiektu już działa
  • 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

Odpytuj zadanie

Odpytuj zwrócone zadanie przy użyciu pasującej ś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 odniesienie do parametrów znajdziesz w oficjalnej dokumentacji Kling.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI key.

Nagłówki

Content-Type
string
domyślnie:application/json

Must be application/json.

Treść

application/json
subject_image_list
object[]
wymagane

Subject reference images. Minimum 1, maximum 4.

Required array length: 1 - 4 elements
model_name
enum<string>
domyślnie:kling-v2

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

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

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

Wymagany zakres: 1 <= x <= 9
aspect_ratio
enum<string>
domyślnie:16:9

Aspect ratio of the generated image.

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

Odpowiedź

200 - application/json

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

code
wymagane

Response code. 0 means the task request was accepted.

message
string
wymagane

Response message.

data
object
wymagane
request_id
string

Request identifier returned when present.