curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-2-6",
"prompt": "A girl on a train looking out of the window, @1 whispers softly",
"image_url": "https://example.com/first-frame.png",
"resolution": "1080p",
"generate_audio": true,
"voice_ids": [
"891495440020668439"
],
"duration": 5
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-2-6",
"prompt": "A girl on a train looking out of the window, @1 whispers softly",
"image_url": "https://example.com/first-frame.png",
"resolution": "1080p",
"generate_audio": True,
"voice_ids": ["891495440020668439"],
"duration": 5
}
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-2-6',
prompt: 'A girl on a train looking out of the window, @1 whispers softly',
image_url: 'https://example.com/first-frame.png',
resolution: '1080p',
generate_audio: true,
voice_ids: ['891495440020668439'],
duration: 5
})
};
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-2-6',
'prompt' => 'A girl on a train looking out of the window, @1 whispers softly',
'image_url' => 'https://example.com/first-frame.png',
'resolution' => '1080p',
'generate_audio' => true,
'voice_ids' => [
'891495440020668439'
],
'duration' => 5
]),
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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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 2.6
Kling 2.6 text-to-video and image-to-video, with optional native audio and designated voices.
Pricing — per second of generated video, in tokens (USD at $0.02/token). Same as the official rate:
| configuration | 720p | 1080p |
|---|---|---|
| No native audio | 2.1 tokens/s ($0.042) | 3.5 tokens/s ($0.07) |
| Native audio | not available | 7 tokens/s ($0.14) |
| Native audio + voice | not available | 8.4 tokens/s ($0.168) |
⚠️ A designated voice is a separate price tier, not a free extra — it is 20% above plain native audio.
⚠️ Three upstream constraints interact, and this endpoint rejects impossible combinations up front (before any tokens are deducted):
voice_idsrequiresgenerate_audio: true— a designated voice cannot be silent.generate_audio: truerequiresresolution: 1080p— Kling publishes no 720p audio tier.- A first and last frame requires
resolution: 720p.
Rules 2 and 3 are mutually exclusive: on Kling 2.6 you cannot combine a first+last frame pair with native audio or voices. Drop image_end_url, or drop generate_audio.
Returns an img_uuid; poll GET /api/v1/jobs/detail (or use custom_callback_url) to get the generated video.
curl --request POST \
--url https://api.goenhance.ai/api/v1/videos/generations \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-2-6",
"prompt": "A girl on a train looking out of the window, @1 whispers softly",
"image_url": "https://example.com/first-frame.png",
"resolution": "1080p",
"generate_audio": true,
"voice_ids": [
"891495440020668439"
],
"duration": 5
}
'import requests
url = "https://api.goenhance.ai/api/v1/videos/generations"
payload = {
"model": "kling-2-6",
"prompt": "A girl on a train looking out of the window, @1 whispers softly",
"image_url": "https://example.com/first-frame.png",
"resolution": "1080p",
"generate_audio": True,
"voice_ids": ["891495440020668439"],
"duration": 5
}
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-2-6',
prompt: 'A girl on a train looking out of the window, @1 whispers softly',
image_url: 'https://example.com/first-frame.png',
resolution: '1080p',
generate_audio: true,
voice_ids: ['891495440020668439'],
duration: 5
})
};
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-2-6',
'prompt' => 'A girl on a train looking out of the window, @1 whispers softly',
'image_url' => 'https://example.com/first-frame.png',
'resolution' => '1080p',
'generate_audio' => true,
'voice_ids' => [
'891495440020668439'
],
'duration' => 5
]),
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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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-2-6\",\n \"prompt\": \"A girl on a train looking out of the window, @1 whispers softly\",\n \"image_url\": \"https://example.com/first-frame.png\",\n \"resolution\": \"1080p\",\n \"generate_audio\": true,\n \"voice_ids\": [\n \"891495440020668439\"\n ],\n \"duration\": 5\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
Model name. Must be kling-2-6.
kling-2-6 Text prompt. Max 2500 characters. Use @1 / @2 to make a designated voice speak.
2500Optional. First-frame image URL. Omit for text-to-video.
Optional. Last-frame image URL. Requires image_url, and forces resolution: 720p.
Optional. Up to 2 voice ids from Kling's Voice Management API (or a system preset). Order is the @1 / @2 numbering. Requires image_url (text-to-video has no materials) and generate_audio: true. voice_id is accepted for a single value.
2Video duration in seconds. Only 5 or 10.
5, 10 Output resolution. No 4K tier. quality is accepted as a compatible alias.
720p, 1080p Output aspect ratio. Text-to-video only — with a first frame the image decides. aspect_ratio is accepted as a compatible alias.
16:9, 9:16, 1:1 Generate a native audio track matching the visuals. Requires resolution: 1080p, and costs more per second.
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"
