Kling 4.0
Generate videos with Kling 4.0 using text, first and last frames, or multimodal references. This page covers the complete request-to-result workflow for this model.
API model ID: kling-4-0
Generation is asynchronous. Save the taskId returned when creating a task, then query its status or receive a webhook.
Capabilities
| Feature | Supported values |
|---|---|
| Output resolution | 720p · 1080p |
| Output duration | 3–30 s |
| Aspect ratio | auto, 16:9, 9:16, 1:1, 21:9 |
| Reference images | Up to 10 images |
| Reference videos | Up to 5 videos |
| Reference audio files | Up to 3 audio files |
| All references combined | Up to 15 reference files in total |
| Reference videos (Σ) | 30 seconds |
| seed | Not supported |
Pricing & credits
Video generation is charged in credits based on the billable duration in seconds. Without video input, the billable duration is the output duration; with video input, it also includes the reference video duration.
The table below lists the credits charged per second, not the total cost of a task. The rate depends on the model, output resolution, and whether reference videos are supplied in reference-to-video mode. See the formulas and examples below the table for the total cost calculation.
| Output resolution | Without video input | With video input |
|---|---|---|
720p | 13 credits/second | 8 credits/second |
1080p | 20 credits/second | 13 credits/second |
- Without video input: output seconds × no-video rate.
- With video input, T is the total reference-video duration measured by the server in seconds. Round up the final credit amount.
ceil((duration + max(duration, T)) × rate) - Image or audio references alone use the no-video rate. The reference-video billing rate applies only in reference-to-video mode when video references are supplied.
Billing examples
5-second 720p text-to-video: 5 × 13 = 65 credits.
5-second 720p output with a 5-second reference video: (5 + 5) × 8 = 80 credits.
Credits are reserved on submission and charged on success. Failed or timed-out tasks enter the refund flow. A refund_failed billing status means the refund did not complete; check the API logs or contact support.
Authentication
Create an API key in the dashboard. The complete key is shown only once. Keep it on your server and send it as a Bearer token on every request.
Base URL
https://api.seevio.aiAuthorization: Bearer sk_live_your_api_key
Content-Type: application/jsonSet the SEEVIO_API_KEY environment variable before running these examples. JavaScript examples run on your server with Node.js; Python examples use the requests package.
Quickstart
Submit this minimal request, save the returned taskId, then use the task query example below. The credits value in the create response is the reserved amount.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "A cat surfing at sunset, cinematic lighting",
"duration": 5,
"resolution": "720p",
"generation_type": "text-to-video"
}
}'Create task response example
After the request above is accepted, the API returns this JSON response. taskId is the task identifier used for subsequent status queries; credits is the number of credits reserved for this task. This response confirms task creation, not that the video is ready. You need to poll the task status or use a Webhook to receive the video results.
{
"taskId": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"credits": 65
}Create a task
POST https://api.seevio.ai/v1/videos/generationsSend a JSON object containing model and input, plus an optional callback_url. Always specify the model ID shown on this page; omitting model selects seedance-2-0.
Request body
| Field | Type | Required | Description & constraints |
|---|---|---|---|
model | string | Yes | Model ID. To use Kling 4.0, set this field to kling-4-0. |
callback_url | string | No | Public HTTPS endpoint for completion and failure POST callbacks. Private networks and localhost are not allowed. Example: https://example.com/webhooks/seevio |
input | object | Yes | Input parameters |
Input parameters
| Field | Type | Default | Description & constraints |
|---|---|---|---|
input.generation_type | string | text-to-video | text-to-video | image-to-video | reference-to-video |
input.prompt | string | — | Up to 8,000 characters. Optional for image-to-video and required otherwise. Number references by type and array order, starting at @Image1, @Video1 and @Audio1. |
input.duration | integer | 5 | 3–30 s |
input.resolution | string | 720p | 720p | 1080p |
input.aspect_ratio | string | Depends on mode | Supported values auto16:99:161:121:9A fixed ratio sets the output shape. If omitted or set to auto, text-to-video uses 16:9, image-to-video follows the first frame, and reference-to-video uses the reference images or videos to determine the ratio. |
input.image_urls | string[] | [] | For image-to-video, supply the first frame followed by an optional last frame. For reference-to-video, supply up to 10 reference images. |
input.keyframe_urls | string[] | [] | Ordered intermediate frames for image-to-video. Up to 9 without a last frame or 8 with one. |
input.video_urls | string[] | [] | For reference-to-video only. Supply HTTPS URLs of videos to guide action or camera movement. Include up to 5 clips, each 2 to 30 seconds long, with a combined duration of at most 30 seconds. |
input.audio_urls | string[] | [] | For reference-to-video only. Supply HTTPS URLs of audio clips to guide the generated voice or sound. Include up to 3 clips, each 5 to 30 seconds long. |
input.keep_original_sound | boolean | false | Applies when video_urls contains a reference video. true keeps its original audio. false (default) generates new audio. With no reference video, this setting is ignored. |
Create response
HTTP 200 returns taskId (string) and credits (number). This acknowledges task creation, not completion. The amount below corresponds to the 5-second 720p quickstart.
{
"taskId": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"credits": 65
}Generation modes & examples
Text to video
Generate from a text prompt. Media URLs are not forwarded in this mode.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "A cat surfing at sunset, cinematic lighting",
"duration": 5,
"resolution": "720p",
"generation_type": "text-to-video"
}
}'First frame
Provide one image as the first frame, then describe the motion in your prompt.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "A cat surfing at sunset, cinematic lighting",
"duration": 5,
"resolution": "720p",
"generation_type": "image-to-video",
"image_urls": [
"https://example.com/first.jpg"
]
}
}'First and last frames
For image-to-video, supply the first frame followed by an optional last frame. For reference-to-video, supply up to 10 reference images.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "",
"duration": 5,
"resolution": "720p",
"generation_type": "image-to-video",
"image_urls": [
"https://example.com/first.jpg",
"https://example.com/last.jpg"
]
}
}'Keyframe example: a rose in bloom
Turn four photos taken from the same angle into an 8-second time-lapse. In image_urls, put the closed bud first and the fully open rose second. These are the opening and closing frames. In keyframe_urls, put the first petals unfurling, followed by the half-open flower. The sequence is bud → opening petals → half-open rose → full bloom. Array order sets the sequence, and the model determines the timing.
Replace example.com media URLs with your own publicly accessible HTTPS files. The sample URLs illustrate the request shape and are not downloadable sample assets.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "A time-lapse of a rose opening. Keep the camera still and the light soft as the petals unfold.",
"duration": 8,
"resolution": "720p",
"generation_type": "image-to-video",
"image_urls": [
"https://example.com/rose-bud.jpg",
"https://example.com/rose-full-bloom.jpg"
],
"keyframe_urls": [
"https://example.com/rose-opening.jpg",
"https://example.com/rose-half-open.jpg"
]
}
}'Multimodal reference
Combine image, video and audio references. The prompt remains required. Reference-video input changes the billing formula.
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "Animate @Image1 with the movement of @Video1 and ambience from @Audio1.",
"duration": 5,
"resolution": "720p",
"generation_type": "reference-to-video",
"image_urls": [
"https://example.com/character.jpg"
],
"video_urls": [
"https://example.com/motion.mp4"
],
"audio_urls": [
"https://example.com/surf.mp3"
],
"keep_original_sound": false
}
}'Query a task
GET https://api.seevio.ai/v1/tasks/{taskId}Replace the example ID with the taskId returned by creation. Queries only return tasks owned by the API key's user; inaccessible or unknown IDs return HTTP 404.
Poll every 10–20 seconds as a starting point, back off on HTTP 429 and stop when the status is completed or failed. Prefer webhooks for production. Each code example below performs one query.
curl --fail-with-body https://api.seevio.ai/v1/tasks/3f2aK9mR7xQp4TnZ8bLc6YwH \
-H "Authorization: Bearer $SEEVIO_API_KEY"| Status | Description & constraints |
|---|---|
queued | Accepted and waiting for submission. |
generating | Generation is in progress. |
completed | Terminal success. Download data.results before expiry. |
failed | Terminal failure. Inspect failed_reason and billing_status. |
| Field | Type | Description & constraints |
|---|---|---|
id | string | Task identifier. This is taskId from the create response. |
created_at | number | Task creation time as Unix seconds. |
model | string | The public model ID used for this task. |
billing_status | string | reserved, charged, refunded or refund_failed. |
credits | number | Credits reserved for this task. This value is retained after a refund; inspect billing_status to determine the billing outcome. |
failed_reason | string | null | Failure reason on failed tasks; null otherwise. Failed query responses omit data. |
data | object | Present on non-failed task queries. Contains output and processing details. |
data.results | string[] | Video URL array. Empty until completion or after the video's expiry. |
data.video_expires_at | string | null | Video expiry as an ISO 8601 timestamp, or null before it is available. Save the result before this time. |
data.last_frame_url | string | null | Last-frame URL when requested and available, otherwise null. |
data.processing_time | number | null | Task processing duration in seconds when available, otherwise null. |
Completed task: query response with video results
When the query returns status=completed, video generation has finished. Read the video URLs from data.results and download them before data.video_expires_at. billing_status=charged indicates that the reserved credits have been charged.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1788652800,
"model": "kling-4-0",
"is_draft": false,
"draft_task_id": null,
"status": "completed",
"billing_status": "charged",
"credits": 65,
"failed_reason": null,
"data": {
"results": [
"https://cdn.seevio.ai/api/videos/example.mp4"
],
"video_expires_at": "2026-09-07T00:00:00Z",
"last_frame_url": null,
"processing_time": 48
}
}Failed task: query response with failure and billing details
When the query returns status=failed, generation has ended unsuccessfully. Read failed_reason for the cause and billing_status for the refund outcome. In this example, refunded means the credits were returned. credits retains the original reserved amount, and the response does not include data.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1788652800,
"model": "kling-4-0",
"is_draft": false,
"draft_task_id": null,
"status": "failed",
"billing_status": "refunded",
"credits": 65,
"failed_reason": "provider_failed"
}Webhooks
Set callback_url in the create request to receive a JSON POST when the task completes or fails. Return a 2xx response within 15 seconds. Failed deliveries are retried; process repeated deliveries idempotently by task ID.
Your callback endpoint must accept POST requests with a JSON request body (Content-Type: application/json).
Create a task with a callback
curl --fail-with-body https://api.seevio.ai/v1/videos/generations \
-H "Authorization: Bearer $SEEVIO_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "kling-4-0",
"input": {
"prompt": "A cat surfing at sunset, cinematic lighting",
"duration": 5,
"resolution": "720p",
"generation_type": "text-to-video"
},
"callback_url": "https://example.com/webhooks/seevio"
}'Task completed: successful callback payload
When generation succeeds, the callback contains status=completed. Use id to identify the task and data.results to retrieve the video URLs. Download and save the results before data.video_expires_at.
created_at is the event creation time; task_created_at is the task creation time in Unix seconds. Examples show the recommended fields; responses may contain additional fields.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1788652848,
"model": "kling-4-0",
"status": "completed",
"task_created_at": 1788652800,
"billing_status": "charged",
"credits": 65,
"failed_reason": null,
"data": {
"results": [
"https://cdn.seevio.ai/api/videos/example.mp4"
],
"video_expires_at": "2026-09-07T00:00:00Z",
"last_frame_url": null,
"processing_time": 48
}
}Task failed: failure callback payload
When generation fails, the callback contains status=failed. Use id to identify the task, failed_reason for the failure reason and credits_refunded for the number of credits refunded.
{
"id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
"created_at": 1788652848,
"model": "kling-4-0",
"status": "failed",
"task_created_at": 1788652800,
"billing_status": "refunded",
"credits": 65,
"failed_reason": "provider_failed",
"credits_refunded": 65
}Receiver example
export async function POST(request: Request) {
const callbackData = await request.json();
if (callbackData.status === "completed") {
const videoUrls = callbackData.data.results;
// Save the video URLs and mark this task as completed in your application.
console.log(callbackData.id, videoUrls);
}
if (callbackData.status === "failed") {
const { failed_reason, credits_refunded } = callbackData;
// Record the failure reason and refunded credits for this task.
console.error(callbackData.id, failed_reason, credits_refunded);
}
return new Response(null, { status: 200 });
}This Next.js example reads the JSON callback body and handles completed and failed tasks directly. Add persistence and task-ID deduplication for your application; queue slow work before acknowledging the callback.
Media requirements & limitations
- All media and callback URLs must be public HTTPS URLs. Avoid localhost, private IPs and files that require cookies or login. Reference video/audio URLs must resolve to directly readable media.
- Each video must not exceed 100 MB.
- Each audio file must not exceed 15 MB.
- Up to 15 reference files in total