Skip to main content
POST
cURL
Usa questo endpoint per creare un task asincrono Kling Omni Image tramite CometAPI. La richiesta di creazione restituisce un task_id; usa Ottenere un task immagine Kling Omni per interrogare il task finché gli URL dell’immagine generata non sono disponibili.
Per il riferimento completo dei parametri del provider, consulta la documentazione Kling Image O1.

Scegli la forma della richiesta

  • Generazione di una singola immagine: invia prompt, image_list, resolution, result_type: single, n e aspect_ratio
  • Output con watermark: aggiungi watermark_info.enabled: true quando ti serve un URL del risultato con watermark nella risposta di query
  • Model ID: ometti model_name per usare il valore predefinito della route, oppure invia un model ID Omni Image testato come kling-image-o1 o kling-v3-omni
Le immagini di riferimento usano elementi image_list con un campo image. Il prompt può farvi riferimento tramite indice, ad esempio <<<image_1>>> per il primo elemento e <<<image_2>>> per il secondo elemento.

Flusso del task

1

Crea il task

Invia POST /kling/v1/images/omni-image e salva il valore restituito in data.task_id.
2

Interroga il task

Esegui il polling di GET /kling/v1/images/omni-image/ finché data.task_status non è succeed o failed.
3

Salva le immagini

Quando il task ha esito positivo, copia data.task_result.images[].url nel tuo storage se ti serve un accesso duraturo.
Per lo schema completo della risposta e gli esempi di polling, consulta Ottenere un task immagine Kling Omni. Il seguente breve esempio interroga un task finché non raggiunge uno stato terminale:

Campi del risultato

Le risposte di query riuscite restituiscono le immagini generate in data.task_result.images. Ogni elemento può includere: Gli URL delle risorse generate possono scadere o essere rimossi dal servizio provider. Salva le immagini finali nel tuo livello di storage quando il tuo workflow richiede una conservazione a lungo termine.

Autorizzazioni

Authorization
string
header
obbligatorio

Bearer token authentication. Use your CometAPI API key.

Intestazioni

Content-Type
string

Must be application/json.

Corpo

application/json
prompt
string
obbligatorio

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>
predefinito:1k

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

Opzioni disponibili:
1k,
2k,
4k
result_type
enum<string>
predefinito:single

Use single for a single-image task.

Opzioni disponibili:
single
n
integer
predefinito:1

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

Intervallo richiesto: 1 <= x <= 9
aspect_ratio
enum<string>
predefinito:auto

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

Opzioni disponibili:
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.

Risposta

200 - application/json

Task accepted.

code
integer
obbligatorio

Response code. 0 means the task request was accepted.

message
string
obbligatorio

Response message.

data
object
obbligatorio
request_id
string

Request identifier returned by CometAPI when present.