curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-refs",
"prompt": "The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>",
"image_urls": [
"https://your-cdn.com/character.jpg"
],
"video_urls": [
"https://your-cdn.com/dance-reference.mp4"
],
"duration": 10,
"ratio": "9:16",
"resolution": "720p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-refs",
"prompt": "The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>",
"image_urls": ["https://your-cdn.com/character.jpg"],
"video_urls": ["https://your-cdn.com/dance-reference.mp4"],
"duration": 10,
"ratio": "9:16",
"resolution": "720p"
}
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-refs',
prompt: 'The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>',
image_urls: ['https://your-cdn.com/character.jpg'],
video_urls: ['https://your-cdn.com/dance-reference.mp4'],
duration: 10,
ratio: '9:16',
resolution: '720p'
})
};
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-refs',
'prompt' => 'The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>',
'image_urls' => [
'https://your-cdn.com/character.jpg'
],
'video_urls' => [
'https://your-cdn.com/dance-reference.mp4'
],
'duration' => 10,
'ratio' => '9:16',
'resolution' => '720p'
]),
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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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 Reference to Video
Kling 4.0 reference-to-video. Guide generation with up to 10 reference images (style, scene, subject) and up to 5 reference videos (motion, camera work and other features to imitate — the videos are not edited). Single takes of up to 30 seconds.
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.
Refer to your assets in prompt as <<<image_1>>>, <<<image_2>>>, <<<video_1>>> …, numbered from 1 in the order of image_urls and video_urls. At least one image or video is required.
Pricing — in tokens (USD at $0.02/token). With reference images only, the price is the same as Kling 4.0 and only the generated seconds are billed. With reference videos, a lower per-second rate applies to output seconds + max(total reference video seconds, output seconds):
| references | resolution | tokens/s | USD/s | billed seconds |
|---|---|---|---|---|
| images only | 720p | 10.205 | $0.2041 | output |
| images only | 1080p | 15.275 | $0.3055 | output |
| with reference videos | 720p | 6.11 | $0.1222 | output + max(reference videos, output) |
| with reference videos | 1080p | 9.165 | $0.1833 | output + max(reference videos, output) |
The total reference video length is measured from your files before any tokens are charged, and rounded up to a whole second. Reference images are not charged.
Examples at 720p:
- 5 seconds with reference images only: 51.03 tokens (= $1.0206)
- 5 seconds with an 8-second reference video: 13 billed seconds, 79.43 tokens (= $1.5886)
- 10 seconds with a 5-second reference video: 20 billed seconds, 122.2 tokens (= $2.444)
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): image_url / image_end_url / keyframes (use Kling 4.0 for first, middle and last frames), sound / generate_audio (audio is always generated), negative_prompt (describe what to avoid in prompt), model_params.multi_shot, and 4K.
curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-refs",
"prompt": "The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>",
"image_urls": [
"https://your-cdn.com/character.jpg"
],
"video_urls": [
"https://your-cdn.com/dance-reference.mp4"
],
"duration": 10,
"ratio": "9:16",
"resolution": "720p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-refs",
"prompt": "The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>",
"image_urls": ["https://your-cdn.com/character.jpg"],
"video_urls": ["https://your-cdn.com/dance-reference.mp4"],
"duration": 10,
"ratio": "9:16",
"resolution": "720p"
}
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-refs',
prompt: 'The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>',
image_urls: ['https://your-cdn.com/character.jpg'],
video_urls: ['https://your-cdn.com/dance-reference.mp4'],
duration: 10,
ratio: '9:16',
resolution: '720p'
})
};
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-refs',
'prompt' => 'The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>',
'image_urls' => [
'https://your-cdn.com/character.jpg'
],
'video_urls' => [
'https://your-cdn.com/dance-reference.mp4'
],
'duration' => 10,
'ratio' => '9:16',
'resolution' => '720p'
]),
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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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-refs\",\n \"prompt\": \"The woman in <<<image_1>>> dances in a snowy forest, following the moves and camera of <<<video_1>>>\",\n \"image_urls\": [\n \"https://your-cdn.com/character.jpg\"\n ],\n \"video_urls\": [\n \"https://your-cdn.com/dance-reference.mp4\"\n ],\n \"duration\": 10,\n \"ratio\": \"9:16\",\n \"resolution\": \"720p\"\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 reference-to-video (reference images and / or reference videos).
Pricing — per billed second:
- 720p, images only — 10.205 tokens ($0.2041)
- 1080p, images only — 15.275 tokens ($0.3055)
- 720p, with reference videos — 6.11 tokens ($0.1222)
- 1080p, with reference videos — 9.165 tokens ($0.1833)
Model name. Must be kling-4-0-refs on this page.
kling-4-0-refs Text prompt. Required, up to 2500 characters. Refer to assets as <<<image_1>>> / <<<video_1>>> (numbered from 1 by array order); a number with no matching asset is rejected.
2500Reference image URLs (up to 10), used as style, scene or subject references. <<<image_1>>> is the first item.
Up to 10MB each, width and height at least 300px. Smaller images are upscaled automatically.
10Reference video URLs (up to 5). <<<video_1>>> is the first item. Each video must be at least 3 seconds, and all videos together at most 30 seconds. MP4 or MOV, up to 200MB, width and height each 720-2160px, 24-60fps.
Adding reference videos switches billing to output + max(reference videos, output) seconds at the reference-video rate (see Pricing).
5Output duration in seconds, any integer from 3 to 30.
3 <= x <= 30Output resolution. quality is accepted as a compatible alias.
720p, 1080p Aspect ratio of the output.
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"
