Skip to main content
POST
cURL
Użyj tego endpointu, aby utworzyć asynchroniczne zadanie Kling Omni Image przez CometAPI. Żądanie utworzenia zwraca task_id; użyj Pobierz zadanie obrazu Kling Omni, aby odpytywać zadanie, aż wygenerowane adresy URL obrazów będą dostępne.
Aby zobaczyć pełne odniesienie parametrów dostawcy, przejdź do dokumentacji Kling Image O1.

Wybierz kształt żądania

  • Generowanie pojedynczego obrazu: wyślij prompt, image_list, resolution, result_type: single, n i aspect_ratio
  • Wynik ze znakiem wodnym: dodaj watermark_info.enabled: true, gdy potrzebujesz adresu URL wyniku ze znakiem wodnym w odpowiedzi zapytania
  • Model ID: pomiń model_name, aby użyć domyślnej wartości trasy, albo wyślij przetestowany model ID Omni Image, taki jak kling-image-o1 lub kling-v3-omni
Obrazy referencyjne używają elementów image_list z polem image. Prompt może się do nich odwoływać za pomocą indeksu, na przykład <<<image_1>>> dla pierwszego elementu i <<<image_2>>> dla drugiego elementu.

Przepływ zadania

1

Utwórz zadanie

Wyślij POST /kling/v1/images/omni-image i zapisz zwrócone data.task_id.
2

Odpytaj zadanie

Odpytuj GET /kling/v1/images/omni-image/, aż data.task_status będzie równe succeed lub failed.
3

Zapisz obrazy

Gdy zadanie zakończy się sukcesem, skopiuj data.task_result.images[].url do własnego magazynu, jeśli potrzebujesz trwałego dostępu.
Aby zobaczyć pełny schemat odpowiedzi i przykłady odpytywania, przejdź do Pobierz zadanie obrazu Kling Omni. Poniższy krótki przykład odpytuje jedno zadanie, aż osiągnie stan końcowy:

Pola wyniku

Pomyślne odpowiedzi zapytania zwracają wygenerowane obrazy w data.task_result.images. Każdy element może zawierać: Adresy URL wygenerowanych zasobów mogą wygasać lub zostać usunięte przez usługę dostawcy. Zapisz gotowe obrazy we własnej warstwie magazynowania, jeśli Twój workflow wymaga długiego przechowywania.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI API key.

Nagłówki

Content-Type
string

Must be application/json.

Treść

application/json
prompt
string
wymagane

Text prompt for the generated image. The prompt can reference images with <<<image_1>>>, <<<image_2>>>, and matching indexes from image_list. Maximum length is 2,500 characters.

model_name
string

Optional model ID for this Omni Image request. Omit this field to use the route default.

image_list
object[]

Reference images that the prompt can cite with <<<image_1>>>, <<<image_2>>>, and so on. Keep the total number of reference images within the provider limits for the selected model.

resolution
enum<string>
domyślnie:1k

Requested output resolution. Use 1k, 2k, or 4k; omitted requests use 1k.

Dostępne opcje:
1k,
2k,
4k
result_type
enum<string>
domyślnie:single

Use single for a single-image task.

Dostępne opcje:
single
n
integer
domyślnie:1

Number of single-image results to generate. Range: 1 to 9.

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

Requested output aspect ratio in width:height format. Use auto to let the provider choose from the prompt and references.

Dostępne opcje:
16:9,
9:16,
1:1,
4:3,
3:4,
3:2,
2:3,
21:9,
auto
watermark_info
object

Watermark options. When enabled is true, the task can return watermarked result URLs in addition to the original result URLs.

callback_url
string<uri>

Webhook URL that receives task status notifications when the task status changes. Omit this field to poll manually.

external_task_id
string

User-defined task ID for your own tracking. It does not replace the system-generated task_id and must be unique per account.

Odpowiedź

200 - application/json

Task accepted.

code
integer
wymagane

Response code. 0 means the task request was accepted.

message
string
wymagane

Response message.

data
object
wymagane
request_id
string

Request identifier returned by CometAPI when present.