Video GenerationKling
Kling 2.1
Kling 2.1 video generation with standard/pro modes and end-image support.
POST /v2/videos/generate — model: "kling-2.1"
Kling 2.1 supports standard and pro modes with optional image-to-video and end-frame control.
See Video Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
klingParams.duration | integer | 5 | Video duration in seconds: 5 or 10 |
klingParams.aspect_ratio | string | — | Aspect ratio in "W:H" format (e.g. "16:9") |
klingParams.mode | string | "pro" | Generation mode: "standard" or "pro" |
klingParams.start_image | string | — | URL of an image to use as the first frame |
klingParams.end_image | string | — | URL of an image to use as the last frame (pro mode) |
klingParams.negative_prompt | string | — | Things to avoid in the video (max 2,500 chars) |
klingParams.cfg_scale | number | — | CFG scale (0–1) |
Credit cost
| Variant | Credits |
|---|---|
standard-5s | 3 |
standard-10s | 5 |
pro-5s | 5 |
pro-10s | 10 |
Code examples
curl -X POST https://api.apiframe.ai/v2/videos/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a drone flyover of a tropical island with crystal clear water",
"model": "kling-2.1",
"klingParams": {
"duration": 10,
"mode": "pro",
"aspect_ratio": "16:9"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/videos/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "a drone flyover of a tropical island with crystal clear water",
"model": "kling-2.1",
"klingParams": {
"duration": 10,
"mode": "pro",
"aspect_ratio": "16:9",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/videos/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "a drone flyover of a tropical island with crystal clear water",
model: "kling-2.1",
klingParams: {
duration: 10,
mode: "pro",
aspect_ratio: "16:9",
},
}),
});
console.log(await response.json());Try it
POST
/v2/videos/generateTry it