Kling
kling-v3
Generate videos with Kling v3 through LinkModel’s unified video generation API, supporting text-to-video and image-to-video workflows.
POST
/
video-generation
kling-v3
curl --request POST \
--url https://api.linkmodel.ai/api/v1/video-generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-v3",
"prompt": "<string>",
"resolution": "720P",
"first_frame_image": "<string>",
"last_frame_image": "<string>",
"duration": 5,
"size": "16x9",
"extends": {},
"extends.audio": false,
"extends.cfg_scale": 0.5,
"extends.negative_prompt": "<string>"
}
'import requests
url = "https://api.linkmodel.ai/api/v1/video-generation"
payload = {
"model": "kling-v3",
"prompt": "<string>",
"resolution": "720P",
"first_frame_image": "<string>",
"last_frame_image": "<string>",
"duration": 5,
"size": "16x9",
"extends": {},
"extends.audio": False,
"extends.cfg_scale": 0.5,
"extends.negative_prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-v3',
prompt: '<string>',
resolution: '720P',
first_frame_image: '<string>',
last_frame_image: '<string>',
duration: 5,
size: '16x9',
extends: {},
'extends.audio': false,
'extends.cfg_scale': 0.5,
'extends.negative_prompt': '<string>'
})
};
fetch('https://api.linkmodel.ai/api/v1/video-generation', 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.linkmodel.ai/api/v1/video-generation",
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-v3',
'prompt' => '<string>',
'resolution' => '720P',
'first_frame_image' => '<string>',
'last_frame_image' => '<string>',
'duration' => 5,
'size' => '16x9',
'extends' => [
],
'extends.audio' => false,
'extends.cfg_scale' => 0.5,
'extends.negative_prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.linkmodel.ai/api/v1/video-generation"
payload := strings.NewReader("{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.linkmodel.ai/api/v1/video-generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linkmodel.ai/api/v1/video-generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"task_id": "cb6111cf-e89f-4978-b8e3-aa59c21cceff",
"order_id": "019da9cf-d1db-78e1-ac23-526774d01193",
"status": "processing",
"price": 0.074
},
"msg": "success",
"request_id": "250b66dd-e1fb-4bb6-b5f6-c668efadc35d"
}{
"code": 400,
"msg": "task_id is required",
"request_id": "96be7a7d-3e81-4916-a6b8-19b32773a693"
}{
"code": 401,
"data": {},
"msg": "invalid api key",
"request_id": "bff4c295-c7da-4507-9708-4627cb6373ba"
}{
"code": 500,
"msg": "create task failed: billing: code=100601: insufficient balance",
"request_id": "3409f6fb-fa9a-4534-b530-195b5f6f4e32"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Must be one of: kling-v3.
Available options:
kling-v3 Length must be between 1 and 2500.
Required string length:
1 - 2500Must be one of: 1080P, 720P. Defaults to 720P.
Available options:
1080P, 720P Provide a reference image to run in image-to-video mode.
End frame for i2v mode only.
Must be one of: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15. Defaults to 5. Value is in s.
Available options:
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 Video aspect ratio. Defaults to 16x9.
Available options:
16x9, 1x1, 9x16 Defaults to false.
Must be between 0 and 1. Defaults to 0.5.
Required range:
0 <= x <= 1Length must be at most 2500.
Maximum string length:
2500Was this page helpful?
⌘I
kling-v3
curl --request POST \
--url https://api.linkmodel.ai/api/v1/video-generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-v3",
"prompt": "<string>",
"resolution": "720P",
"first_frame_image": "<string>",
"last_frame_image": "<string>",
"duration": 5,
"size": "16x9",
"extends": {},
"extends.audio": false,
"extends.cfg_scale": 0.5,
"extends.negative_prompt": "<string>"
}
'import requests
url = "https://api.linkmodel.ai/api/v1/video-generation"
payload = {
"model": "kling-v3",
"prompt": "<string>",
"resolution": "720P",
"first_frame_image": "<string>",
"last_frame_image": "<string>",
"duration": 5,
"size": "16x9",
"extends": {},
"extends.audio": False,
"extends.cfg_scale": 0.5,
"extends.negative_prompt": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-v3',
prompt: '<string>',
resolution: '720P',
first_frame_image: '<string>',
last_frame_image: '<string>',
duration: 5,
size: '16x9',
extends: {},
'extends.audio': false,
'extends.cfg_scale': 0.5,
'extends.negative_prompt': '<string>'
})
};
fetch('https://api.linkmodel.ai/api/v1/video-generation', 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.linkmodel.ai/api/v1/video-generation",
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-v3',
'prompt' => '<string>',
'resolution' => '720P',
'first_frame_image' => '<string>',
'last_frame_image' => '<string>',
'duration' => 5,
'size' => '16x9',
'extends' => [
],
'extends.audio' => false,
'extends.cfg_scale' => 0.5,
'extends.negative_prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.linkmodel.ai/api/v1/video-generation"
payload := strings.NewReader("{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.linkmodel.ai/api/v1/video-generation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.linkmodel.ai/api/v1/video-generation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"kling-v3\",\n \"prompt\": \"<string>\",\n \"resolution\": \"720P\",\n \"first_frame_image\": \"<string>\",\n \"last_frame_image\": \"<string>\",\n \"duration\": 5,\n \"size\": \"16x9\",\n \"extends\": {},\n \"extends.audio\": false,\n \"extends.cfg_scale\": 0.5,\n \"extends.negative_prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"task_id": "cb6111cf-e89f-4978-b8e3-aa59c21cceff",
"order_id": "019da9cf-d1db-78e1-ac23-526774d01193",
"status": "processing",
"price": 0.074
},
"msg": "success",
"request_id": "250b66dd-e1fb-4bb6-b5f6-c668efadc35d"
}{
"code": 400,
"msg": "task_id is required",
"request_id": "96be7a7d-3e81-4916-a6b8-19b32773a693"
}{
"code": 401,
"data": {},
"msg": "invalid api key",
"request_id": "bff4c295-c7da-4507-9708-4627cb6373ba"
}{
"code": 500,
"msg": "create task failed: billing: code=100601: insufficient balance",
"request_id": "3409f6fb-fa9a-4534-b530-195b5f6f4e32"
}