Skip to content
中文
Kling · Model API

Kling 4.0 API Pricing

Kling 4.0 API with VezAPI. Explore model capabilities, credit pricing, request parameters, and integration examples.

Text to VideoImage to Video

Kling 4.0 API documentation

Integrate Kling 4.0 with your VezAPI key. The operations below share the same authentication and account balance.

Base URL: https://api.vezapi.com
Send Authorization: Bearer YOUR_VEZAPI_KEY. Use a unique Idempotency-Key for each submission; reuse it only when checking the same request.

Kling 4.0 Keyframe To Video

POST/api/v1/jobs/createTask

Model IDs: kling-4.0/keyframe-to-video

ParameterTypeDescription & constraints
model
required
string

The name of the model used to generate the task. This field is required. - This endpoint requires the `kling-4.0/keyframe-to-video` model

Values: "kling-4.0/keyframe-to-video"

Default: "kling-4.0/keyframe-to-video"

callBackUrl
optional
string

The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation

input
required
object

Input parameters for the generation task.

input.prompt
required
string

Video description. Required. Maximum 8000 characters. Use `@first_frame`, `@keyframe_1`, `@keyframe_2`, …, `@last_frame` to mention frames that you uploaded in this request. You can only mention frames that are actually provided. Every `@` mention must match an asset included in this request, otherwise the request is rejected. Mentions use longest-match against declared names. If the matched name ends with a letter, digit, or underscore, the next character cannot be a letter, digit, or underscore.

minLength: 1

maxLength: 8000

input.duration
optional
integer

Output video duration in seconds. Integer from 3 to 30. Default: `5`. Also caps the total number of frames (first + middle + last): - 3 s → 4 frames - 4 s → 5 frames - 5 s → 6 frames - 6 s → 7 frames - 7 s → 8 frames - 8 s → 9 frames - 9 s or longer → 10 frames

Default: 5

minimum: 3

maximum: 30

input.resolution
optional
string

Output resolution. `720p` or `1080p`. Default: `720p`.

Values: "720p", "1080p"

Default: "720p"

input.aspect_ratio
optional
string

Output aspect ratio. Only used when no frame is provided (text-to-video); default is `16:9`. If any frame is provided, the output follows the first frame's aspect ratio.

Values: "auto", "16:9", "9:16", "1:1", "21:9"

input.first_frame_url
optional
string

First-frame image URL. Mention it in the prompt as `@first_frame`.

input.keyframe_urls
optional
array

Middle-frame image URLs, in chronological order. Up to 8 images, also limited by `duration`. Mention them in the prompt as `@keyframe_1`, `@keyframe_2`, ….

Default: []

maxItems: 8

input.last_frame_url
optional
string

Last-frame image URL. Mention it in the prompt as `@last_frame`.

Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "kling-4.0/keyframe-to-video",
  "input": {
    "prompt": "The girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "auto"
  }
}'
Responses and errors

HTTP 200

Request Successful

ParameterTypeDescription & constraints
code
optional
integer

Response status code - **200**: Success - Request has been processed successfully - **401**: Unauthorized - Authentication credentials are missing or invalid - **402**: Insufficient Credits - Account does not have enough credits to perform the operation - **404**: Not Found - The requested resource or endpoint does not exist - **422**: Validation Error - The request parameters failed validation checks - **429**: Rate Limited - Request limit has been exceeded for this resource - **433**: Request Limit - Sub-key Usage Exceeds Limit - **455**: Service Unavailable - System is currently undergoing maintenance - **500**: Server Error - An unexpected error occurred while processing the request - **501**: Generation Failed - Content generation task failed - **505**: Feature Disabled - The requested feature is currently disabled

Values: 200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
optional
string

Response message, error description when failed

data
required
object
data.taskId
required
string

Task ID, can be used with Get Task Details endpoint to query task status

Kling 4.0 Reference To Video

POST/api/v1/jobs/createTask

Model IDs: kling-4.0/reference-to-video

ParameterTypeDescription & constraints
model
required
string

The name of the model used to generate the task. This field is required. - This endpoint requires the `kling-4.0/reference-to-video` model

Values: "kling-4.0/reference-to-video"

Default: "kling-4.0/reference-to-video"

callBackUrl
optional
string

The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation

input
required
object

Input parameters for the generation task.

input.prompt
required
string

Video description. Required. Maximum 8000 characters. Use `@` to mention assets uploaded in this request: - `@image_1`, `@image_2`, … map to `image_urls` in order (1-based) - `@video_1`, `@video_2`, … map to `video_urls` - `@name` maps to the `name` of an item in `elements` or `voices` Every `@` mention must match an asset included in this request, otherwise the request is rejected. Mentions use longest-match against declared names. If the matched name ends with a letter, digit, or underscore, the next character cannot be a letter, digit, or underscore.

minLength: 1

maxLength: 8000

input.duration
optional
integer

Output video duration in seconds. Integer from 3 to 30. Default: `5`.

Default: 5

minimum: 3

maximum: 30

input.resolution
optional
string

Output resolution. `720p` or `1080p`. Default: `720p`.

Values: "720p", "1080p"

Default: "720p"

input.aspect_ratio
optional
string

Output aspect ratio. Optional. - If omitted and any reference asset is provided, the model uses `auto` - If omitted and no reference asset is provided, the model uses `16:9`

Values: "auto", "16:9", "9:16", "1:1", "21:9"

input.image_urls
optional
array

Reference images, up to 10 publicly accessible URLs. Mention them in the prompt as `@image_1`, `@image_2`, … in array order. Each side must be 300–65536 pixels; aspect ratio 0.40–2.5.

Default: []

maxItems: 10

input.video_urls
optional
array

Reference videos, up to 5 clips, each 2–30 seconds. Mention them in the prompt as `@video_1`, `@video_2`, …. Reference videos plus video subjects in `elements` cannot exceed 5 in total.

Default: []

maxItems: 5

input.keep_original_sound
optional
boolean

Whether to keep the original audio of the reference videos. Only takes effect when `video_urls` is provided. Default: `false`. If no reference video is provided, native audio is always generated.

Default: false

input.elements
optional
array

Subjects used only for this task. Up to 7 items, of which at most 3 can be video subjects. Mention them in the prompt as `@name`. `image_urls`, `video_urls`, `elements`, and `voices` together cannot exceed 15 items.

Default: []

maxItems: 7

input.elements[].name
required
string

The name used in the prompt as `@Hero`. 1–20 characters; Chinese, letters, digits, and underscore only. Must be unique across `elements` and `voices` (case-insensitive). Reserved names (case-insensitive, N is a number) cannot be used: `image_N`, `video_N`, `keyframe_N`, `object_N`, `audio_N`, `first_frame`, `last_frame`.

input.elements[].image_urls
optional
array

2–4 publicly accessible image URLs for an image subject. Cannot be used together with `video_url`. The first image is the primary view (front face or main angle); the rest are supporting views.

minItems: 2

maxItems: 4

input.elements[].video_url
optional
string

Character video URL for a video subject. Cannot be used together with `image_urls`. One video, 3–8 seconds, a single continuous shot (no cuts), shortest side at least 700 pixels.

input.elements[].tag
optional
string

Subject category. Optional for image subjects — if omitted, it is inferred from the primary image. Video subjects are always `character`; any other value is rejected.

Values: "character", "animal", "prop", "costume", "scene", "effect", "others"

input.elements[].description
optional
string

Optional subject description. Maximum 100 characters.

maxLength: 100

input.elements[].voice_url
optional
string

Optional reference audio bound to this subject. It cannot be mentioned with `@` on its own and does not count toward the `voices` quota. Only character subjects can bind audio: for image subjects `tag` must be `character` or omitted; for video subjects, if omitted and the video contains speech, that speech is used automatically.

input.voices
optional
array

Standalone voice references used only for this task. Up to 3 items. Mention them in the prompt as `@name`. Audio bound on a subject via `voice_url` is separate and does not count toward this quota.

Default: []

maxItems: 3

input.voices[].name
required
string

The name used in the prompt as `@Narrator`. 1–20 characters; Chinese, letters, digits, and underscore only. Must be unique across `elements` and `voices` (case-insensitive). Reserved names (case-insensitive, N is a number) cannot be used: `image_N`, `video_N`, `keyframe_N`, `object_N`, `audio_N`, `first_frame`, `last_frame`.

input.voices[].audio_url
required
string

Publicly accessible reference audio URL. Required. The task fails if no usable voice can be detected.

Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "kling-4.0/reference-to-video",
  "input": {
    "prompt": "@Hero sits at the desk in @video_1, picks up the doll from @image_1, and greets using @Narrator",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "auto"
  }
}'
Responses and errors

HTTP 200

Request Successful

ParameterTypeDescription & constraints
code
optional
integer

Response status code - **200**: Success - Request has been processed successfully - **401**: Unauthorized - Authentication credentials are missing or invalid - **402**: Insufficient Credits - Account does not have enough credits to perform the operation - **404**: Not Found - The requested resource or endpoint does not exist - **422**: Validation Error - The request parameters failed validation checks - **429**: Rate Limited - Request limit has been exceeded for this resource - **433**: Request Limit - Sub-key Usage Exceeds Limit - **455**: Service Unavailable - System is currently undergoing maintenance - **500**: Server Error - An unexpected error occurred while processing the request - **501**: Generation Failed - Content generation task failed - **505**: Feature Disabled - The requested feature is currently disabled

Values: 200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
optional
string

Response message, error description when failed

data
required
object
data.taskId
required
string

Task ID, can be used with Get Task Details endpoint to query task status

Task status and callbacks

For asynchronous tasks, keep the returned taskId. Query GET /api/v1/jobs/recordInfo?taskId=... or provide callBackUrl when creating the task. Only the account that created a task can access it or derive new resources from it.

A timeout can mean the submission was accepted. Inspect the existing request in your dashboard; do not create another task automatically. Callback delivery is retried and may arrive more than once. Deduplicate with X-VezAPI-Event-Id.

Files, logs and billing

Generated media normally follows a 14-day provider lifetime; uploaded files expire after 24 hours. Save the files you need before expiration. VezAPI streams registered files without keeping a permanent media library. Request logs are retained for two calendar months.

Credits are reserved before submission. Final deductions match actual discounted consumption one for one. Unknown usage pauses new paid requests. If available funds cannot cover final usage while protecting other reservations, settlement stays pending until funded; model usage cannot make the wallet negative. Time-based inputs require server-side metadata reads; a failed read prevents submission.

Open full documentation →

Kling 4.0 API pricing

Rates below are reference estimates; final deductions equal actual discounted consumption, one for one. At the standard pack rate, 1,000 credits ≈ $10. Larger packs reduce the effective credit price.

SpecificationCreditsUnitUSD reference
kling 4.0, keyframe-to-video, 1080P42.5per second$0.425
kling 4.0, keyframe-to-video, 720P28.5per second$0.285
kling 4.0, reference-to-video, 1080P with video input25.5per second$0.255
kling 4.0, reference-to-video, 720P with video input17per second$0.17
kling 4.0, reference-to-video, 1080P no video input42.5per second$0.425
kling 4.0, reference-to-video, 720P no video input28.5per second$0.285