curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0",
"prompt": "The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo",
"image_url": "https://your-cdn.com/product-front.jpg",
"keyframes": [
"https://your-cdn.com/product-side.jpg"
],
"image_end_url": "https://your-cdn.com/product-logo.jpg",
"duration": 10,
"resolution": "1080p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0",
"prompt": "The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo",
"image_url": "https://your-cdn.com/product-front.jpg",
"keyframes": ["https://your-cdn.com/product-side.jpg"],
"image_end_url": "https://your-cdn.com/product-logo.jpg",
"duration": 10,
"resolution": "1080p"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-4-0',
prompt: 'The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo',
image_url: 'https://your-cdn.com/product-front.jpg',
keyframes: ['https://your-cdn.com/product-side.jpg'],
image_end_url: 'https://your-cdn.com/product-logo.jpg',
duration: 10,
resolution: '1080p'
})
};
fetch('https://api.goenhance.ai/api/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goenhance.ai/api/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'kling-4-0',
'prompt' => 'The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo',
'image_url' => 'https://your-cdn.com/product-front.jpg',
'keyframes' => [
'https://your-cdn.com/product-side.jpg'
],
'image_end_url' => 'https://your-cdn.com/product-logo.jpg',
'duration' => 10,
'resolution' => '1080p'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goenhance.ai/api/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goenhance.ai/api/v1/videos/generations")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5",
"cost": 5.82
}
}Kling 4.0
Kling 4.0, Kuaishou’s flagship video model. Text-to-video and image-to-video with single takes of up to 30 seconds: start from a first frame, guide the take through up to 8 middle keyframes, and optionally end on a last frame.
Audio — every generated video comes with a native audio track. It is always on: the model has no switch for it, so sound / generate_audio are rejected.
Pricing — per second of generated video, in tokens (USD at $0.02/token). Text-to-video and image-to-video cost the same; first, middle and last frames are not charged:
| resolution | tokens/s | USD/s |
|---|---|---|
| 720p | 10.205 | $0.2041 |
| 1080p | 15.275 | $0.3055 |
Example: a 5-second video at 720p costs 51.03 tokens.
Returns an img_uuid; poll GET /api/v1/jobs/detail (or use custom_callback_url) to get the generated video.
Not accepted by this model (rejected before any tokens are charged): sound / generate_audio (audio is always generated), negative_prompt (describe what to avoid in prompt), model_params.multi_shot (use keyframes to guide one take), reference images (image_urls; use Kling 4.0 Reference to Video), and 4K.
curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0",
"prompt": "The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo",
"image_url": "https://your-cdn.com/product-front.jpg",
"keyframes": [
"https://your-cdn.com/product-side.jpg"
],
"image_end_url": "https://your-cdn.com/product-logo.jpg",
"duration": 10,
"resolution": "1080p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0",
"prompt": "The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo",
"image_url": "https://your-cdn.com/product-front.jpg",
"keyframes": ["https://your-cdn.com/product-side.jpg"],
"image_end_url": "https://your-cdn.com/product-logo.jpg",
"duration": 10,
"resolution": "1080p"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-4-0',
prompt: 'The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo',
image_url: 'https://your-cdn.com/product-front.jpg',
keyframes: ['https://your-cdn.com/product-side.jpg'],
image_end_url: 'https://your-cdn.com/product-logo.jpg',
duration: 10,
resolution: '1080p'
})
};
fetch('https://api.goenhance.ai/api/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goenhance.ai/api/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'kling-4-0',
'prompt' => 'The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo',
'image_url' => 'https://your-cdn.com/product-front.jpg',
'keyframes' => [
'https://your-cdn.com/product-side.jpg'
],
'image_end_url' => 'https://your-cdn.com/product-logo.jpg',
'duration' => 10,
'resolution' => '1080p'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goenhance.ai/api/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goenhance.ai/api/v1/videos/generations")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-4-0\",\n \"prompt\": \"The product slowly rotates on a marble pedestal, soft studio light, the camera pushes in for a close-up of the logo\",\n \"image_url\": \"https://your-cdn.com/product-front.jpg\",\n \"keyframes\": [\n \"https://your-cdn.com/product-side.jpg\"\n ],\n \"image_end_url\": \"https://your-cdn.com/product-logo.jpg\",\n \"duration\": 10,\n \"resolution\": \"1080p\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5",
"cost": 5.82
}
}Headers
Body
Kling 4.0 text-to-video and image-to-video (first frame, optional middle keyframes, optional last frame).
Pricing — per second of generated video:
- 720p — 10.205 tokens ($0.2041)
- 1080p — 15.275 tokens ($0.3055)
Model name. Must be kling-4-0 on this page.
kling-4-0 Text prompt describing the scene, motion and camera. Required, up to 2500 characters.
2500First-frame image URL. If provided, runs image-to-video (the aspect ratio follows this image); otherwise text-to-video.
JPG or PNG, up to 10MB, width and height at least 300px, aspect ratio between 1:2.5 and 2.5:1. Smaller images are upscaled automatically.
Optional middle-frame image URLs (1-8), in playback order. The model spaces them evenly between the first and last frame. Requires image_url.
First, middle and last frames together allow at most 10 images and at most duration + 1 (a 3-second video takes up to 4). Same image requirements as image_url.
8Optional last-frame image URL. Requires image_url. Same image requirements as image_url.
Video duration in seconds, any integer from 3 to 30.
3 <= x <= 30Output resolution. quality is accepted as a compatible alias.
720p, 1080p Aspect ratio. Text-to-video only; ignored when image_url is provided.
16:9, 9:16, 1:1, 21:9 Optional. A publicly accessible HTTPS URL. When the task status changes (processing / success / failed), GoEnhance sends a POST request to this URL. The request body is identical to the response of GET /api/v1/jobs/detail. If your server does not respond with HTTP 200, the notification is retried up to 3 times, with a 3-second timeout per attempt.
"https://your-server.com/goenhance/callback"
