Crear una tarea de imagen Kling Omni
Usa CometAPI POST /kling/v1/images/omni-image para crear tareas de Kling Omni Image con entradas de prompt e imagen de referencia.
task_id; usa Obtener una tarea de imagen Kling Omni para consultar la tarea hasta que las URL de las imágenes generadas estén disponibles.
Elige la forma de la solicitud
- Generación de una sola imagen: envía
prompt,image_list,resolution,result_type: single,nyaspect_ratio - Salida con marca de agua: agrega
watermark_info.enabled: truecuando necesites una URL de resultado con marca de agua en la respuesta de consulta - Model ID: omite
model_namepara usar el valor predeterminado de la ruta, o envía un model ID de Omni Image probado comokling-image-o1okling-v3-omni
image_list con un campo image. El prompt puede citarlas por índice, como <<<image_1>>> para el primer elemento y <<<image_2>>> para el segundo elemento.
Flujo de la tarea
Crear la tarea
POST /kling/v1/images/omni-image y guarda el data.task_id devuelto.Consultar la tarea
data.task_status sea succeed o failed.Persistir las imágenes
data.task_result.images[].url en tu propio almacenamiento si necesitas acceso duradero.Campos del resultado
Las respuestas de consulta exitosas devuelven las imágenes generadas endata.task_result.images. Cada elemento puede incluir:
Autorizaciones
Bearer token authentication. Use your CometAPI API key.
Encabezados
Must be application/json.
Cuerpo
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.
Optional model ID for this Omni Image request. Omit this field to use the route default.
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.
Requested output resolution. Use 1k, 2k, or 4k; omitted requests use 1k.
1k, 2k, 4k Use single for a single-image task.
single Number of single-image results to generate. Range: 1 to 9.
1 <= x <= 9Requested output aspect ratio in width:height format. Use auto to let the provider choose from the prompt and references.
16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9, auto Watermark options. When enabled is true, the task can return watermarked result URLs in addition to the original result URLs.
Webhook URL that receives task status notifications when the task status changes. Omit this field to poll manually.
User-defined task ID for your own tracking. It does not replace the system-generated task_id and must be unique per account.