This document introduces the Kling Videos Generation API integration guide, which allows generating official Kling videos by inputting custom parameters.Documentation Index
Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
Use this file to discover all available pages before exploring further.
Application Process
To use the API, you need to apply for the corresponding service on the Kling Videos Generation API page. After entering the page, click the “Acquire” button, as shown below:
If you are not logged in or registered, you will be automatically redirected to the login page to register and log in. After logging in or registering, you will be automatically returned to the current page.
There is a free quota granted upon the first application, allowing free use of the API.
Basic Usage
First, understand the basic usage: by inputting the promptprompt, generation action action, first frame reference image start_image_url, and model model, you can get the processed result. You need to simply pass an action field with the value text2video. It mainly includes three actions: text-to-video (text2video), image-to-video (image2video), and extend video (extend). Then, you also need to input the model model. Currently, the main models are kling-v1, kling-v1-6, kling-v2-master, kling-v2-1-master, kling-v2-5-turbo, kling-v2-6, kling-v3, kling-v3-omni, and kling-video-o1. Details are as follows:

accept: the desired response format, here set toapplication/json(JSON format).authorization: the API key for calling the API, which can be selected from a dropdown after application.
model: the video generation model, mainlykling-v1,kling-v1-6,kling-v2-master,kling-v2-1-master,kling-v2-5-turbo,kling-v2-6,kling-v3,kling-v3-omni,kling-video-o1.mode: the video generation mode, optional values are standard modestd, pro modepro, and native 4K mode4k. The4kmode only supportskling-v3andkling-v3-omniand is incompatible withcamera_control(camera movement control).action: the behavior of this video generation task, mainly three types: text-to-video (text2video), image-to-video (image2video), and extend video (extend).start_image_url: required first frame reference image URL when choosing image-to-video actionimage2video.end_image_url: optional end frame for image-to-video.duration: video length in seconds. Forkling-v3andkling-v3-omni, flexible durations from 3 to 15 seconds (integers) are supported; other models support 5 or 10 seconds.generate_audio: whether to generate audio synchronously, optional boolean. Supported bykling-v3,kling-v3-omni, andkling-v2-6(pro mode only). Default isfalse.aspect_ratio: video aspect ratio, optional, supports16:9,9:16,1:1, default is16:9.cfg_scale: correlation strength, range [0,1], the larger the value, the closer to the prompt.camera_control: optional, parameters controlling camera movement, supports type/simple presets and configurations such as horizontal, vertical, pan, tilt, roll, zoom.negative_prompt: optional, negative prompts to avoid, up to 200 characters.element_list: main subject reference list, only applicable to modelkling-video-o1. Refer to the official documentation for usage details.video_list: reference videos accessed via URL, only applicable to modelkling-video-o1. Refer to the official documentation for usage details.prompt: the prompt.callback_url: URL for callback results.

success: the status of the video generation task.task_id: the video generation task ID.video_id: the video ID of the generated video.video_url: the video URL of the generated video.duration: the video length.state: the state of the video generation task.
data field to access the generated Kling video.
Additionally, if you want to generate the corresponding integration code, you can directly copy the generated code. For example, the CURL code is as follows:
Model Capability Matrix
Different models vary significantly in parameter support. The following matrix is compiled from the Kling official video models documentation. Before calling, please verify whether the currentmodel / mode / duration combination supports your required features; otherwise, upstream will return errors like model/mode/duration(...) is not supported with image_tail.
| Model | Mode | end_image_url (start/end frame) | generate_audio (audio) | camera_control (camera movement) | Notes |
|---|---|---|---|---|---|
kling-v1 | std / pro | ✅ only duration=5 | ❌ | ✅ only duration=5 | extend does not support negative_prompt and cfg_scale |
kling-v1-6 | std | ❌ | ❌ | ❌ | Multi-image video and extend full mode available |
kling-v1-6 | pro | ✅ | ❌ | ❌ | |
kling-v2-master | — | ❌ | ❌ | ❌ | Single mode, only duration=5/10 |
kling-v2-1-master | — | ❌ | ❌ | ❌ | Single mode, only duration=5/10 |
kling-v2-5-turbo | std | ❌ | ❌ | ❌ | |
kling-v2-5-turbo | pro | ✅ | ❌ | ❌ | |
kling-v2-6 | std | ❌ | ❌ | ❌ | |
kling-v2-6 | pro | ✅ | ✅ | ❌ | The only non-v3 model supporting audio |
kling-v3 | std / pro | ✅ | ✅ | ✅ | duration range 3–15 seconds |
kling-v3 | 4k | ✅ | ✅ | ❌ | 4K mode incompatible with camera movement |
kling-v3-omni | std / pro / 4k | ✅ | ✅ | ❌ | |
kling-video-o1 | std / pro | ✅ | ❌ | ❌ | Only supports duration=5/10 |
mode=4kis only supported bykling-v3andkling-v3-omni; it is mutually exclusive withcamera_control.end_image_urlcan only be used withstart_image_urlwhenaction=image2video. Passing onlyend_image_url(withoutstart_image_url) will be rejected.kling-v3/kling-v3-omniaccept any integerdurationfrom 3 to 15 seconds; other models only accept 5 or 10 seconds.generate_audiodefaults tofalse. Supported only bykling-v3,kling-v3-omni, andkling-v2-6(pro mode).
Extend Video Feature
If you want to continue generating an already generated Kling video, set the parameteraction to extend and input the video ID to continue generating. The video ID is obtained from the basic usage as shown below:

Note that the video_id here is the ID of the generated video. If you don’t know how to generate a video, refer to the basic usage section above.
Next, you must fill in the prompt for the next step to customize the video generation. You can specify the following:
model: video generation model, mainlykling-v1,kling-v1-5, andkling-v1-6.mode: video generation mode, optional values are standard modestd, pro modepro, and native 4K mode4k(only supported bykling-v3andkling-v3-omni, incompatible with camera control).duration: video length for this generation task, mainly 5s and 10s.start_image_url: required first frame reference image URL when choosing image-to-video actionimage2video.prompt: prompt.


Asynchronous Callback
Since Kling Videos Generation API takes relatively long time to generate videos (about 1-2 minutes), if the API does not respond for a long time, the HTTP request will keep the connection open, causing extra system resource consumption. Therefore, this API also supports asynchronous callbacks. The overall process is: when the client initiates a request, it additionally specifies acallback_url field. After the client sends the API request, the API immediately returns a result containing a task_id field representing the current task ID. When the task is completed, the generated video result will be sent to the client’s specified callback_url via POST JSON, including the task_id field, so the task result can be correlated by ID.
Let’s understand the specific operation through an example.
First, the Webhook callback is a service that can receive HTTP requests. Developers should replace it with their own HTTP server URL. For demonstration, we use a public Webhook sample site https://webhook.site/. Open the site to get a Webhook URL, as shown:
Copy this URL, which can be used as the Webhook. The example URL here is https://webhook.site/624b2c78-6dbd-4618-9d2b-b32eade6d8c3.
Next, set the callback_url field to the above Webhook URL and fill in the corresponding parameters, as shown:

https://webhook.site/624b2c78-6dbd-4618-9d2b-b32eade6d8c3, as shown:
Content as follows:
task_id field, and other fields are similar to above. This field allows task correlation.
Error Handling
When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, rate limit exceeded.500 api_error: Internal server error.

