
Kling 4.0 API
Kuaishou Kling 4.0 for video up to 30 seconds from text, first and last frames, or image and video references.
Output
Quick start
Video API reference- Create an API key
Create a key in the console and save it as the MLMUX_API_KEY environment variable.
Create an API key - Send a request
Send the request to https://api.mlmux.com/v1/videos/generations with the model ID kwaivgi/kling-4.0. The example uses this page's default settings; change the prompt and options as needed.
- Read the result
The response is a task. Poll its poll_url every few seconds until status is succeeded, then download the video, or set up a webhook to be notified.
curl https://api.mlmux.com/v1/videos/generations \
-H "Authorization: Bearer $MLMUX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kwaivgi/kling-4.0",
"route_mode": "official-cheap",
"prompt": "A red fox walks through fresh snow at sunrise, slow tracking shot, cinematic light",
"mode": "text_to_video",
"ratio": "16:9",
"resolution": "720p",
"duration": 5
}'
# The response is a task. Poll it until "status" is "succeeded", then read "video".
curl https://api.mlmux.com/v1/videos/generations/TASK_ID \
-H "Authorization: Bearer $MLMUX_API_KEY"Examples
View more examples ↗Pricing
Video is billed per second of output at the resolution you choose. The price changes with resolution and route.
Learn more about pricing ↗All video rates
Per second of output video, by resolution. Billing follows the seconds the provider reports.
| Resolution | official | official-cheap |
|---|---|---|
| 720p | $0.154 / s | $0.138 / s |
| 1080p | $0.231 / s | $0.208 / s |
Readme
Kling 4.0 is available through MLMux with one request shape and two explicit route tiers.
Up to 30 seconds
Kling 4.0 makes clips from 3 to 30 seconds, at 720p or 1080p.
Frames and references
Start from a prompt, animate first and last frames, or guide the clip with up to 10 reference images and 5 reference videos.
Billed per second
You pay for each second of output at the chosen resolution.
Frequently asked questions
What is Kling 4.0?
Kling 4.0 is a video generation model from Kuaishou. On MLMux you can run it in the browser or call it through one API. Kuaishou Kling 4.0 for video up to 30 seconds from text, first and last frames, or image and video references.
How do I use the Kling 4.0 API?
Create an API key in the MLMux Console, then send a POST request to https://api.mlmux.com/v1/videos/generations with the key in the Authorization header and model set to kwaivgi/kling-4.0. The request returns a task: poll it, or receive a webhook when the video is ready.
What can Kling 4.0 do?
Generation modes: Text to video, Image to video, First & last frame, and Multimodal reference. Clips run 3 to 30 seconds at 720p or 1080p, in aspect ratios such as 16:9, 9:16, 1:1, and 21:9, with up to 10 reference images.
How much does Kling 4.0 cost?
MLMux is pay as you go, with no subscription or monthly fee, and 1 credit equals 1 US dollar. One second of 720p Kling 4.0 video costs $0.138 on the default official-cheap route and $0.154 on the official route. Rates for every resolution are listed in the pricing section of this page.
Can I try Kling 4.0 without writing code?
Yes. Sign in and use the playground at the top of this page to run Kling 4.0 with the same settings as the API. The playground's code views show the matching request for your settings, and the quick start below has copy-paste examples in cURL, Python, and JavaScript.












