Skip to main content
POST
cURL
Use este endpoint quando quiser que o Kling gere uma imagem a partir de várias referências de assunto, além de referências opcionais de cena ou estilo.

Antes de chamar

  • Forneça de 1 a 4 imagens em subject_image_list
  • Use model_name: kling-v2-1 para novas solicitações
  • Adicione scene_image ou style_image apenas quando a composição principal do assunto já estiver funcionando
  • Trate isso como uma rota de geração assíncrona e salve o id da tarefa retornado

Fluxo da tarefa

1

Enviar a tarefa de geração de imagem

Envie a lista de imagens de assunto e o prompt, depois armazene o id da tarefa retornado.
2

Consultar a tarefa

Consulte a tarefa retornada com o caminho de consulta de imagem Kling correspondente até que a tarefa alcance um estado terminal.
3

Persistir o resultado

Salve a imagem gerada no seu próprio armazenamento se precisar de acesso durável.
Para a referência completa de parâmetros, consulte a documentação oficial do Kling.

Autorizações

Authorization
string
header
obrigatório

Bearer token authentication. Use your CometAPI key.

Cabeçalhos

Content-Type
string
padrão:application/json

Must be application/json.

Corpo

application/json
subject_image_list
object[]
obrigatório

Subject reference images. Minimum 1, maximum 4.

Required array length: 1 - 4 elements
model_name
enum<string>
padrão:kling-v2

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

Opções disponíveis:
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
padrão:1

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

Intervalo necessário: 1 <= x <= 9
aspect_ratio
enum<string>
padrão:16:9

Aspect ratio of the generated image.

Opções disponíveis:
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.

Resposta

200 - application/json

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

code
obrigatório

Response code. 0 means the task request was accepted.

message
string
obrigatório

Response message.

data
object
obrigatório
request_id
string

Request identifier returned when present.