Application Process
To use the API, you need to first apply for the corresponding service on the Kling Videos Generation API page. After entering the page, click the “Acquire” button, as shown in the image below:
If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page.
Upon your first application, there will be a free quota available for you to use the API for free.
Basic Usage
First, understand the basic usage method, which involves inputting the promptprompt, the action action, the starting frame reference image start_image_url, and the model model to obtain the processed result. You first need to simply pass a field action with the value text2video, which mainly includes three actions: text-to-video (text2video), image-to-video (image2video), and video extension (extend). Then, you also need to input the model model, which currently mainly includes kling-v1, kling-v1-6, kling-v2-master, kling-v2-1-master, kling-v2-5-turbo, and kling-video-o1 models, as detailed below:

accept: the format of the response result you want to receive, filled in asapplication/json, which means JSON format.authorization: the key to call the API, which can be directly selected after application.
model: the model for generating the video, mainly includingkling-v1,kling-v1-6,kling-v2-master,kling-v2-1-master,kling-v2-5-turbo, andkling-video-o1models.mode: the mode for generating the video, mainly including standard modestdand fast modepro.action: the action for this video generation task, mainly including three actions: text-to-video (text2video), image-to-video (image2video), and video extension (extend).start_image_url: when selecting the image-to-video actionimage2video, the starting frame reference image link must be uploaded.end_image_url: optional for image-to-video, specifies the ending frame.aspect_ratio: the aspect ratio of the video, optional, supports16:9,9:16,1:1, default is16:9.cfg_scale: relevance strength, range [0,1], the larger the value, the more it fits the prompt.camera_control: optional, controls the parameters of camera movement, supports type/simple presets as well as configurations like horizontal, vertical, pan, tilt, roll, zoom, etc.negative_prompt: optional, reverse prompts that you do not want to appear, up to 200 characters.element_list: subject reference list, applicable only to thekling-video-o1model; refer to the official documentation for specific usage.video_list: reference videos, obtained via URL, applicable only to thekling-video-o1model; refer to the official documentation for specific usage.prompt: the prompt.callback_url: the URL for the callback result.

success: the status of the video generation task at this time.task_id: the ID of the video generation task at this time.video_id: the video ID of the video generation task at this time.video_url: the video link of the video generation task at this time.duration: the duration of the video generation task at this time.state: the status of the video generation task at this time.
data result.
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:
Video Extension Functionality
If you want to continue generating an already created Kling video, you can set the parameteraction to extend and input the ID of the video you want to continue generating. The video ID can be obtained based on the basic usage, as shown in the image below:

Note that the video_id here is the ID of the generated video. If you do not know how to generate a video, you can refer to the basic usage above to generate a video.
Next, you must fill in the prompt for the next step to customize the video generation, and you can specify the following content:
model: The model for generating videos, mainly includingkling-v1,kling-v1-5, andkling-v1-6.mode: The mode for generating videos, mainly including standard modestdand high-speed modepro.duration: The duration of the video generation task, mainly including 5s and 10s.start_image_url: The link to the reference image for the first frame that must be uploaded when selecting the image-to-video actionimage2video.prompt: The prompt words.


Asynchronous Callback
Since the Kling Videos Generation API takes a relatively long time to generate, approximately 1-2 minutes, if the API does not respond for a long time, the HTTP request will keep the connection open, leading to additional system resource consumption. Therefore, this API also provides support for asynchronous callbacks. The overall process is: when the client initiates a request, an additionalcallback_url field is specified. After the client initiates the API request, the API will immediately return a result containing a task_id field, representing the current task ID. When the task is completed, the result of the generated video will be sent to the client-specified callback_url in the form of a POST JSON, which also includes the task_id field, allowing the task result to be associated by ID.
Let’s understand how to operate specifically through an example.
First, the Webhook callback is a service that can receive HTTP requests, and developers should replace it with the URL of their own HTTP server. For demonstration purposes, a public Webhook sample site https://webhook.site/ is used, and opening this site will provide a Webhook URL, as shown in the image:
Copy this URL, and it can be used as a Webhook. The sample here is https://webhook.site/624b2c78-6dbd-4618-9d2b-b32eade6d8c3.
Next, we can set the callback_url field to the above Webhook URL and fill in the corresponding parameters, as shown in the image:

https://webhook.site/624b2c78-6dbd-4618-9d2b-b32eade6d8c3, as shown in the image:
The content is as follows:
task_id field, and the other fields are similar to the above text, allowing the task to be associated through this field.
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, you have exceeded the rate limit.500 api_error: Internal server error, something went wrong on the server.

