Skip to Content
Video ModelsKling 4.0 Flash

Kling 4.0 Flash

Overview

Kling 4.0 Flash is the Flash model in the Kling 4.0 family, which Kling positions for faster generation and greater value. On Kie.ai, the Kling 4.0 Flash API offers two models: Reference to Video, which accepts a prompt with optional reference images, elements, or reference videos, and Keyframe to Video, which generates a video from a single first-frame image. Both output 720p MP4 clips from 3 to 20 seconds.

Test API KEY: key_00000000000000000000000000000000

Endpoints

1. Create Task

Request

POST https://api.pixwithapi.online/api/task/create

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Api-Key{API_KEY}Yes

Request Parameters

ParameterTypeRequiredDescription
model_idstringYes2-106.
promptstringYesVideo description, 1–5,000 characters. Use @first_frame to refer to the supplied image.
image_urlsarray of URLsNoOmit or pass [] for text-to-video. For image-to-video, provide exactly one first-frame image. JPG, JPEG, PNG, or WebP, up to 10 MiB.
optionsobjectNoOmitted fields use the defaults below.
options.resolutionstringNo720P only. Default: 720P.
options.durationintNoAny integer from 3 through 20 seconds. Default: 5.
options.aspect_ratiostringNoText-to-video: 16:9, 9:16, 1:1, or 21:9. Default: 16:9. The output follows the first frame when an image is provided.
options.prompt_optimizationbooleanNoOptimize the prompt before generation. Default: false.

Example Request — Text to Video

{ "model_id": "2-106", "prompt": "An orange ball rolls slowly across a blue background, fixed camera", "options": { "resolution": "720P", "duration": 5, "aspect_ratio": "16:9", "prompt_optimization": false } }

Example Request — Image to Video

{ "model_id": "2-106", "prompt": "The character in @first_frame walks toward the camera", "image_urls": ["https://media.example.com/start.webp"], "options": { "resolution": "720P", "duration": 10, "prompt_optimization": false } }

Response Parameters

ParameterTypeDescription
codeint1 for success, 0 for error.
messagestringSuccess or failure message.
data.task_idstringTask identifier for querying the result.
data.estimated_timeintEstimated generation time in seconds; actual completion time varies.

Response

{ "code": 1, "message": "success", "data": { "task_id": "d425ab4dc256f0ebaa84862b9cea8a3d", "estimated_time": 200 } }

2. Create Task With R2V

Use the same endpoint and headers as above. At least one reference image is required, including when reference videos are supplied.

Request Parameters

ParameterTypeRequiredDescription
model_idstringYes2-107.
promptstringYesVideo description, 1–5,000 characters. Refer to images as @image_1, @image_2, etc. and videos as @video_1, @video_2, etc.
reference_urlsobjectYesOrdered reference media URL arrays.
reference_urls.reference_imagesarray of URLsYes1–10 JPG, JPEG, PNG, or WebP images, up to 10 MiB each.
reference_urls.reference_videosarray of URLsNo0–5 MP4, MOV, MKV, AVI, or WebM videos, up to 10 MiB each. Each video must be 2–20 seconds; their actual combined duration must not exceed 20 seconds. This limit applies to the input videos, independently of output duration.
optionsobjectNoOmitted fields use the defaults below.
options.resolutionstringNo720P only. Default: 720P.
options.durationintNoAny integer from 3 through 20 seconds. Default: 5.
options.aspect_ratiostringNoAuto, 16:9, 9:16, 1:1, or 21:9. Default: Auto.
options.soundbooleanNoKeep the original audio of reference videos when true. Default: false. This setting only applies when a reference video is supplied.
options.prompt_optimizationbooleanNoOptimize the prompt before generation. Default: true.

Images and videos together must not exceed 15 materials. Reference URLs must be publicly downloadable HTTPS URLs with a supported path extension. Optional arrays may be omitted or set to []; do not pass null. Array order determines the prompt references. Elements, separate audio inputs, voices, and end frames are not supported.

Example Request

{ "model_id": "2-107", "prompt": "The person in @image_1 follows the movement in @video_1", "reference_urls": { "reference_images": ["https://media.example.com/person.jpg"], "reference_videos": ["https://media.example.com/motion.mp4"] }, "options": { "resolution": "720P", "duration": 15, "aspect_ratio": "16:9", "sound": true, "prompt_optimization": false } }

For an image-only R2V request, omit reference_videos; keep at least one entry in reference_images.

Response

{ "code": 1, "message": "success", "data": { "task_id": "d425ab4dc256f0ebaa84862b9cea8a3d" } }

This response confirms acceptance for asynchronous media preparation. It does not include estimated_time or confirm that generation has started. Preparation failures can be retrieved using the same task ID. Preparation that exceeds 10 minutes is cancelled; this is not a limit on generation time.

3. Get Task Status & Results

Call POST /api/task/get with the returned task_id. Public status values are 1 for processing, 2 for completed, and 3 for failed. Completed tasks include result_urls; preparation failures or cancellations include error_code and error_message when available.

See Get Task Status & Results for the complete request and response format.

Last updated on