AI video generation supporting text-to-video, image-to-video, audio generation and voice customization.
Add Authorization header with Bearer token to all requests:
Authorization: Bearer YOUR_API_KEY
| Model | API Name | Features | Price (85% off) |
|---|---|---|---|
| Kling V2.6 | kling-v2-6 | 5s/10s, Text/Image-to-Video, Audio+Voice | From $0.0159 |
| Kling V3 | kling-v3 | 3-15s, Text/Image-to-Video, Audio, Per-Second | From $0.0064/s |
| Kling Motion Control | kling-motion-control | Motion Control, 720p/1080p, Up to 30s | From $0.06/s |
| Mode | Duration | Audio | Voice | $ |
|---|---|---|---|---|
| std | 5s | - | - | $0.0159 |
| std | 10s | - | - | $0.0320 |
| pro | 5s | - | - | $0.0267 |
| pro | 10s | - | - | $0.0531 |
| pro | 5s | on | - | $0.0531 |
| pro | 10s | on | - | $0.1064 |
| pro | 5s | on | on | $0.0639 |
| pro | 10s | on | on | $0.1275 |
| Mode | Duration | Audio | $/s |
|---|---|---|---|
| std | 3-15s | - | $0.0633 |
| std | 3-15s | on | $0.0956 |
| pro | 3-15s | - | $0.0853 |
| pro | 3-15s | on | $0.1280 |
| Resolution | Duration | $ |
|---|---|---|
| Kling 2.6 · 720p | Up to 30s | $0.06/s |
| Kling 2.6 · 1080p | Up to 30s | $0.10/s |
| Kling 3.0 · 720p | Up to 30s | $0.12/s |
| Kling 3.0 · 1080p | Up to 30s | $0.15/s |
/api/v1/video/generationsCreate a Kling video generation task. Automatically routes to text-to-video or image-to-video based on whether image parameter is provided.
/api/v1/video/generations?task_id=xxxQuery task status and get video URL
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.
curl -X POST https://apimodels.app/api/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"
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "pending",
"model": "kling-video/kling-v2-6"
}
}{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "completed",
"model": "kling-video/kling-v2-6",
"resultUrls": ["https://...video.mp4"],
"createTime": 1705123450000,
"completeTime": 1705123500000
}
}{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "failed",
"model": "kling-video/kling-v2-6",
"failMsg": "Content policy violation"
}
}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.
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 | "string",
"failMsg": null | "string",
"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.
{
"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":[]}.
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
})pendingTask queued, waiting to processprocessingVideo is being generatedcompletedVideo generation successfulfailedVideo generation failed400Bad Request - Missing or invalid parameters401Unauthorized - Invalid API key402Payment Required - Insufficient credits404Not Found - Task ID not found500Internal Server Error