Skip to main content
POST
cURL
Use este endpoint para animar uma imagem de origem em um vídeo do Kling.

Antes de chamar

  • Forneça uma URL pública de imagem ou uma string de imagem em base64
  • Use uma imagem que atenda aos requisitos de pixels do Kling; miniaturas muito pequenas são rejeitadas pela tarefa de geração
  • Comece com o exemplo padrão kling-v2-6 e depois escolha outro model_name a partir do enum do OpenAPI quando precisar de uma trilha de modelo diferente
  • Mantenha a primeira solicitação simples: uma imagem de entrada, um prompt, sem frame final, sem máscaras de movimento
  • Use dynamic_masks como um array de objetos de máscara e trajetória quando precisar de movimento local controlado
  • Use sound: off para uma primeira solicitação determinística sem áudio em trilhas de modelo que oferecem suporte a som gerado

Nomenclatura de modelos

Use model IDs comuns de vídeo do Kling neste endpoint. Mantenha os model IDs Omni para Omni Video.

Fluxo da tarefa

1

Envie a solicitação de image-to-video

Crie a tarefa e armazene o task_id retornado pelo Kling.
2

Consulte a tarefa

Continue com Obter uma tarefa do Kling para acompanhar o status da tarefa até que a saída esteja pronta.
3

Armazene o resultado

Persista o asset finalizado se precisar de retenção além da URL de entrega do provedor.
Para a referência completa de parâmetros, consulte o documento oficial do Kling.

Autorizações

Authorization
string
header
obrigatório

Bearer token authentication. Use your CometAPI key.

Corpo

application/json
image
string
obrigatório

Source image URL or base64 image string. Use an image that meets Kling pixel requirements; very small thumbnails are rejected. For base64 input, send the encoded image string as the field value.

prompt
string

Text prompt describing the desired motion. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

callback_url
string

Webhook URL to receive task status updates when the task completes.

mode
enum<string>
padrão:std

Generation mode. std for standard (faster), pro for professional (higher quality).

Opções disponíveis:
std,
pro
model_name
enum<string>
padrão:kling-v1

Model ID for this image-to-video request. Use kling-v3 for new requests. Use Omni model IDs only with the Omni Video endpoint.

Opções disponíveis:
kling-v1,
kling-v1-5,
kling-v1-6,
kling-v2-master,
kling-v2-1,
kling-v2-1-master,
kling-v2-5-turbo,
kling-v2-6,
kling-v3
image_tail
string

Tail-frame reference image as a Base64 string or public URL. Same format requirements as image. Controls the last frame of the generated video.

cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

duration
string
padrão:5

Output video length in seconds. Use 5 or 10; omit to use 5.

static_mask
string

Static brush mask image as a Base64 string or public URL. White areas are frozen in place during video generation. Must match the aspect ratio and resolution of the input image.

dynamic_masks
object[]

Optional motion masks. Each entry contains a mask image and an ordered trajectory list.

external_task_id
string

Custom task id for your own tracking. Does not replace the system-generated task id but can be used to query tasks. Must be unique per user.

sound
enum<string>

Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.

Opções disponíveis:
on,
off

Resposta

200 - application/json

Task accepted.

code
integer
obrigatório

Error code; specifically define the error code

message
string
obrigatório

error message

data
object
obrigatório