APIMODELSAPIMODELS
Документация API

apimodels.app

Docs/Kling Video API
KV

Kling Video API

AI video generation supporting text-to-video, image-to-video, audio generation and voice customization.

Quick Start

1
Get your API key from the Console
2
Choose a Kling video model (kling-v2-6 or kling-v3)
3
Send POST request to create task
4
Poll GET request for video result

Authentication

Add Authorization header with Bearer token to all requests:

Authorization: Bearer YOUR_API_KEY

Available Models

ModelAPI NameFeaturesPrice
Kling V2.6kling-v2-65s/10s, Text/Image-to-Video, Audio+VoiceFrom $0.22
Kling V3kling-v33-15s, Text/Image-to-Video, Audio, Per-SecondFrom $0.12/s
Kling Motion Controlkling-motion-controlMotion Control, 720p/1080p, Up to 30sFrom $0.06/s

The multi-modal Omni models, Kling Video-O1 and Kling V3 Omni (text, image, video and subject input, plus video editing), are documented on the Kling Omni-Video API page.

Detailed Pricing

Kling V2.6 (Kling's official rates)

ModeDurationAudioVoice$
std5s--$0.22
std10s--$0.44
pro5s--$0.36
pro10s--$0.73
pro5son-$0.73
pro10son-$1.47
pro5sonon$0.88
pro10sonon$1.76

Kling V3

ModeDurationAudio$/s
std3-15s-$0.12/s
std3-15son$0.18/s
pro3-15s-$0.16/s
pro3-15son$0.24/s

Kling Motion Control (30% off)

ResolutionDuration$
Kling 2.6 · 720pUp to 30s$0.06/s
Kling 2.6 · 1080pUp to 30s$0.10/s
Kling 3.0 · 720pUp to 30s$0.10/s
Kling 3.0 · 1080pUp to 30s$0.15/s

Endpoints

POST/api/v1/video/generations

Create a Kling video generation task. Automatically routes to text-to-video or image-to-video based on whether image parameter is provided.

GET/api/v1/video/generations?task_id=xxx

Query task status and get video URL

Request Parameters

Common Parameters

modelrequiredstring
"kling-v2-6", "kling-v3", or "kling-motion-control"
promptstring
Text prompt (max 2500 chars). Required for text-to-video.
imagestring
Reference image (base64 or URL). If provided, uses image-to-video mode.
modestring
"std" (standard) or "pro" (high quality). Default: "std"
durationstring
V2.6: "5" or "10". V3: "3" to "15". Default: "5"
soundstring
"on" or "off". Enable audio generation. Default: "off"
negative_promptstring
Negative text prompt (max 2500 chars)
aspect_ratiostring
Video aspect ratio (width:height)
cfg_scalenumber
Creativity control. Higher = closer to prompt.
callback_urlstring
Webhook URL for completion notification

Advanced Parameters

image_tailstring
Tail frame reference image (image-to-video only)
voice_listarray
Voice IDs for voice customization (V2.6+ only, max 2)
camera_controlobject
Camera movement control (type + config)
multi_shotboolean
Enable multi-shot video generation
watermark_infoobject
{ enabled: true/false } - Generate watermarked version
motion_videostring
Motion reference video URL (kling-motion-control only). Provide the motion source video to drive character animation.

Kling Motion Control

When using model "kling-motion-control", provide image (character reference image) and motion_video (motion source video) to generate a video of the character performing the motion. Supports up to 30s, 720p/1080p.

Code Examples

curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-v2-6",
    "prompt": "A girl dancing on the beach at sunset, cinematic lighting",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9"
  }'

Response Format

Create Task Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "pending",
    "model": "kling-video/kling-v2-6"
  }
}

Success Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "completed",
    "model": "kling-video/kling-v2-6",
    "resultUrls": ["https://...video.mp4"],
    "createTime": 1705123450000,
    "completeTime": 1705123500000
  }
}

Failed Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "failed",
    "model": "kling-video/kling-v2-6",
    "failMsg": "Content policy violation"
  }
}

Webhook Callback (callback_url)

Pass callback_url in the create request. When the task reaches the completed or failed terminal state, our server sends a single HTTP POST to that URL with Content-Type: application/json (no signing header). Delivery is retried up to 3 times (exponential backoff 1s/2s/4s, 10s per attempt); if still unsuccessful, a background job keeps retrying for up to 30 minutes until your endpoint returns 2xx.

Payload Structure

POST {your callback_url}
Content-Type: application/json

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "model": "kling-video/kling-v2-6",
    "state": "completed" | "failed",
    "param": "<JSON string>",            // request params, JSON.parse once
    "resultJson": "<JSON string> | null", // result object, JSON.parse once
    "failCode": null | "CONTENT_MODERATION | INVALID_INPUT | INSUFFICIENT_BALANCE | UPSTREAM_BUSY | UPSTREAM_FAILED | TIMEOUT | INTERNAL_ERROR | OTHER",
    "failMsg": null | "string",
    "retryable": true | false,           // present when state=failed: safe to retry/fallback
    "costTime": 12345,                    // duration in ms
    "completeTime": 1705123500000,        // ms epoch
    "createTime": 1705123450000           // ms epoch
  }
}

Note: data.param and data.resultJson are both JSON strings — call JSON.parse once on each.

Video task: shape after JSON.parse(data.resultJson)

{
  "resultUrls":    ["https://r2.apimodels.app/videos/xxx.mp4"],
  "videoDuration": 5,                  // optional, seconds
  "thumbnailUrl":  "https://...jpg",   // optional
  "videoSize":     "1280x720",         // optional
  "videoModel":    "kling-v2-6"        // optional
}

resultUrls is always present (length 1 in success, [] on failure). Other fields are optional and depend on the upstream — read defensively. When state=failed, resultJson is typically null or {"resultUrls":[]}.

Node.js receiver example

app.post('/webhook/kling-video', express.json(), (req, res) => {
  const { taskId, state, resultJson, failMsg } = req.body.data
  if (state === 'completed') {
    const r = JSON.parse(resultJson)
    console.log('video ready', taskId, r.resultUrls[0], r.videoDuration)
  } else {
    console.warn('video failed', taskId, failMsg)
  }
  res.status(200).end()                 // must be 2xx, otherwise we retry
})

Notes

  • -A task stops retrying only after a 2xx response — once delivered it is never pushed again.
  • -Callbacks are not signed today. Embed a random token in your callback_url path and verify it on receipt.
  • -Kling video jobs typically take 30s to several minutes — strongly prefer callback_url over polling.
  • -Use a public HTTPS endpoint that responds within 10 seconds (per-attempt timeout).

Task States

pendingTask queued, waiting to process
processingVideo is being generated
completedVideo generation successful
failedVideo generation failed

Error Codes

400Bad Request - Missing or invalid parameters
401Unauthorized - Invalid API key
402Payment Required - Insufficient credits
404Not Found - Task ID not found
500Internal Server Error

Important Notes

  • *Video files are stored for 30 days, download promptly
  • *If image parameter is provided, image-to-video mode is used automatically
  • *V3 supports flexible 3-15s duration with per-second pricing
  • *Audio generation is available for V2.6 (pro mode only) and V3 (set sound: "on")
  • *Voice customization requires V2.6+ with sound: "on" and voice_list
  • *Poll every 5-10 seconds to check status
  • *Kling Motion Control requires both image (character reference) and motion_video (motion source) parameters

FAQ

How do I generate a Kling video from text or an image?

POST /api/v1/video/generations with a Kling model and a prompt (add first_frame_url for image-to-video), then poll GET ?task_id=. One key covers Kling and every other video model.

How is Kling video priced?

Per second of output, by model and resolution; you are charged only on success. New accounts start with $0.1 free.