curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-edit",
"prompt": "Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>",
"video_urls": [
"https://your-cdn.com/original.mp4"
],
"image_urls": [
"https://your-cdn.com/coat-style.jpg"
],
"resolution": "1080p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-edit",
"prompt": "Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>",
"video_urls": ["https://your-cdn.com/original.mp4"],
"image_urls": ["https://your-cdn.com/coat-style.jpg"],
"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-edit',
prompt: 'Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>',
video_urls: ['https://your-cdn.com/original.mp4'],
image_urls: ['https://your-cdn.com/coat-style.jpg'],
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-edit',
'prompt' => 'Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>',
'video_urls' => [
'https://your-cdn.com/original.mp4'
],
'image_urls' => [
'https://your-cdn.com/coat-style.jpg'
],
'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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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 Video Edit
Kling 4.0 video edit. Change an existing clip with a prompt — swap outfits, restyle the scene, regrade the colors — optionally guided by up to 10 style reference images. The output keeps the aspect ratio and the original audio of your video.
Refer to the source video in prompt as <<<video_1>>> and to reference images as <<<image_1>>>, <<<image_2>>> … in the order of image_urls.
Pricing — in tokens (USD at $0.02/token), billed on output seconds + max(source video seconds, output seconds):
| resolution | tokens/s | USD/s |
|---|---|---|
| 720p | 6.11 | $0.1222 |
| 1080p | 9.165 | $0.1833 |
The source video length is measured from your file before any tokens are charged, and rounded up to a whole second. With the default duration: "auto" the output is as long as the source, so a request is billed for twice the source length. Reference images are not charged.
Examples at 720p:
- 5-second source,
durationauto: 10 billed seconds, 61.1 tokens (= $1.222) - 10-second source,
duration20: 40 billed seconds, 244.4 tokens (= $4.888)
Returns an img_uuid; poll GET /api/v1/jobs/detail (or use custom_callback_url) to get the edited video.
Not accepted by this model (rejected before any tokens are charged): ratio / aspect_ratio (the output follows the source video), sound / generate_audio (the output always keeps the audio of your video), negative_prompt, image_url / image_end_url / keyframes, and 4K.
curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-4-0-edit",
"prompt": "Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>",
"video_urls": [
"https://your-cdn.com/original.mp4"
],
"image_urls": [
"https://your-cdn.com/coat-style.jpg"
],
"resolution": "1080p"
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-4-0-edit",
"prompt": "Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>",
"video_urls": ["https://your-cdn.com/original.mp4"],
"image_urls": ["https://your-cdn.com/coat-style.jpg"],
"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-edit',
prompt: 'Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>',
video_urls: ['https://your-cdn.com/original.mp4'],
image_urls: ['https://your-cdn.com/coat-style.jpg'],
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-edit',
'prompt' => 'Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>',
'video_urls' => [
'https://your-cdn.com/original.mp4'
],
'image_urls' => [
'https://your-cdn.com/coat-style.jpg'
],
'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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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-edit\",\n \"prompt\": \"Replace the coat worn by the person in <<<video_1>>> with the style in <<<image_1>>>\",\n \"video_urls\": [\n \"https://your-cdn.com/original.mp4\"\n ],\n \"image_urls\": [\n \"https://your-cdn.com/coat-style.jpg\"\n ],\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 video edit (one source video, optional style reference images).
Pricing — per billed second (output + max(source, output)):
- 720p — 6.11 tokens ($0.1222)
- 1080p — 9.165 tokens ($0.1833)
Model name. Must be kling-4-0-edit on this page.
kling-4-0-edit Editing instructions. Required, up to 2500 characters. Refer to the source video as <<<video_1>>> and to reference images as <<<image_1>>> …; a number with no matching asset is rejected.
2500The video to edit — exactly one URL. 3 to 30 seconds. MP4 or MOV, up to 200MB, width and height each 720-2160px, 24-60fps.
1 elementOptional style reference image URLs (up to 10). <<<image_1>>> is the first item.
Up to 10MB each, width and height at least 300px. Smaller images are upscaled automatically.
10Output duration: "auto" (default) matches the source video, or any integer from 3 to 30 seconds. Billing uses output + max(source, output) seconds.
3 <= x <= 30Output resolution. quality is accepted as a compatible alias.
720p, 1080p 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"
