curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-flash-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": 8,
"ratio": "9:16"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-flash-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": 8,
"ratio": "9:16"
}
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-flash-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: 8,
ratio: '9:16'
})
};
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-flash-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' => 8,
'ratio' => '9:16'
]),
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-flash-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\": 8,\n \"ratio\": \"9:16\"\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-flash-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\": 8,\n \"ratio\": \"9:16\"\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-flash-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\": 8,\n \"ratio\": \"9:16\"\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 Flash Reference to Video
Kling 4.0 Flash 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). 720p only, single takes of up to 20 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 Flash 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 | tokens/s | USD/s | billed seconds |
|---|---|---|---|
| images only | 5.5715 | $0.11143 | output |
| with reference videos | 3.7143 | $0.074286 | 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:
- 5 seconds with reference images only: 27.86 tokens (= $0.5572)
- 5 seconds with an 8-second reference video: 13 billed seconds, 48.29 tokens (= $0.9658)
- 10 seconds with a 5-second reference video: 20 billed seconds, 74.29 tokens (= $1.4858)
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 Flash for a first frame), reference audio, sound / generate_audio (audio is always generated), negative_prompt, seed, model_params.multi_shot, and 1080p / 4K.
curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-flash-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": 8,
"ratio": "9:16"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-flash-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": 8,
"ratio": "9:16"
}
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-flash-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: 8,
ratio: '9:16'
})
};
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-flash-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' => 8,
'ratio' => '9:16'
]),
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-flash-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\": 8,\n \"ratio\": \"9:16\"\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-flash-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\": 8,\n \"ratio\": \"9:16\"\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-flash-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\": 8,\n \"ratio\": \"9:16\"\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 Flash reference-to-video (reference images and / or reference videos).
Pricing — per billed second:
- images only — 5.5715 tokens ($0.11143)
- with reference videos — 3.7143 tokens ($0.074286)
Model name. Must be kling-4-0-flash-refs on this page.
kling-4-0-flash-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, aspect ratio between 2:5 and 5:2. 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 20 seconds. MP4 or MOV, up to 200MB, height 700-4553px.
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 20.
3 <= x <= 20Output resolution. Kling 4.0 Flash only supports 720p. quality is accepted as a compatible alias.
720p 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"
