Passer au contenu principal
POST
/
kling
/
v1
/
videos
/
image2video
curl --request POST \
  --url https://api.cometapi.com/kling/v1/videos/image2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "image": "https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg"
}
'
{
  "code": 0,
  "message": "success",
  "data": {
    "task_id": "2032273942220931072",
    "task_status": "submitted",
    "task_info": {},
    "created_at": 1773366840306,
    "updated_at": 1773366840306
  }
}

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Utilisez ce endpoint pour animer une image source en une vidéo Kling.

Avant de l’appeler

  • Fournissez une URL d’image publique ou une chaîne d’image en base64
  • Commencez avec model_name: kling-v2-master pour une requête moderne minimale
  • Gardez la première requête simple : une image d’entrée, un prompt, pas de frame de fin, pas de masques de mouvement

Flux de tâche

1

Soumettre la requête image-vers-vidéo

Créez la tâche et stockez le task_id Kling renvoyé.
2

Interroger la tâche

Poursuivez avec Requêtes individuelles pour suivre l’état de la tâche jusqu’à ce que la sortie soit prête.
3

Stocker le résultat

Conservez la ressource finale si vous avez besoin d’une rétention au-delà de l’URL de livraison du fournisseur.
Pour la référence complète des paramètres, consultez le document officiel Kling.

Autorisations

Authorization
string
header
requis

Bearer token authentication. Use your CometAPI key.

Corps

application/json
image
string
défaut:example
requis

Source image as a Base64 string or public URL. Accepted formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300×300 px.

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
string

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

model_name
string

Kling model variant to use. See the Models page for current options.

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

Output video length in seconds. Options: 5, 10.

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

Dynamic brush configuration. Up to 6 groups, each containing a painted-area mask and a motion trajectory.

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.

Réponse

200 - application/json

Task accepted.

code
integer
requis

Error code; specifically define the error code

message
string
requis

error message

data
object
requis