Kling 4.0 Text-to-Video Task
curl --request POST \
--url https://api.powertokens.ai/kling/text-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model_name": "kling-4.0",
"prompt": "A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.",
"settings": {
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "16:9"
},
"options": {
"callback_url": "",
"external_task_id": "",
"watermark_info": {
"enabled": false
}
}
}
'import requests
url = "https://api.powertokens.ai/kling/text-to-video"
payload = {
"model_name": "kling-4.0",
"prompt": "A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.",
"settings": {
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "16:9"
},
"options": {
"callback_url": "",
"external_task_id": "",
"watermark_info": { "enabled": False }
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
model_name: 'kling-4.0',
prompt: 'A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.',
settings: {duration: 10, resolution: '1080p', aspect_ratio: '16:9'},
options: {callback_url: '', external_task_id: '', watermark_info: {enabled: false}}
})
};
fetch('https://api.powertokens.ai/kling/text-to-video', 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.powertokens.ai/kling/text-to-video",
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_name' => 'kling-4.0',
'prompt' => 'A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.',
'settings' => [
'duration' => 10,
'resolution' => '1080p',
'aspect_ratio' => '16:9'
],
'options' => [
'callback_url' => '',
'external_task_id' => '',
'watermark_info' => [
'enabled' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$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.powertokens.ai/kling/text-to-video"
payload := strings.NewReader("{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
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.powertokens.ai/kling/text-to-video")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.powertokens.ai/kling/text-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"id": "string",
"status": "submitted",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string"
}
}Kling
Kling Text-to-Video kling-4.0
Submit a Kling 4.0 text-to-video task via /kling/text-to-video; the model is specified by model_name. Query task status with GET /kling/tasks. Note: The platform does not yet integrate elements (element) or voices (voice); the related parameters are not supported yet.
POST
/
kling
/
text-to-video
Kling 4.0 Text-to-Video Task
curl --request POST \
--url https://api.powertokens.ai/kling/text-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model_name": "kling-4.0",
"prompt": "A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.",
"settings": {
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "16:9"
},
"options": {
"callback_url": "",
"external_task_id": "",
"watermark_info": {
"enabled": false
}
}
}
'import requests
url = "https://api.powertokens.ai/kling/text-to-video"
payload = {
"model_name": "kling-4.0",
"prompt": "A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.",
"settings": {
"duration": 10,
"resolution": "1080p",
"aspect_ratio": "16:9"
},
"options": {
"callback_url": "",
"external_task_id": "",
"watermark_info": { "enabled": False }
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({
model_name: 'kling-4.0',
prompt: 'A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.',
settings: {duration: 10, resolution: '1080p', aspect_ratio: '16:9'},
options: {callback_url: '', external_task_id: '', watermark_info: {enabled: false}}
})
};
fetch('https://api.powertokens.ai/kling/text-to-video', 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.powertokens.ai/kling/text-to-video",
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_name' => 'kling-4.0',
'prompt' => 'A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.',
'settings' => [
'duration' => 10,
'resolution' => '1080p',
'aspect_ratio' => '16:9'
],
'options' => [
'callback_url' => '',
'external_task_id' => '',
'watermark_info' => [
'enabled' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$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.powertokens.ai/kling/text-to-video"
payload := strings.NewReader("{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Bearer <token>")
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.powertokens.ai/kling/text-to-video")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.powertokens.ai/kling/text-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"model_name\": \"kling-4.0\",\n \"prompt\": \"A man in a white shirt walks along the beach at dusk, camera slowly following, realistic cinematic style.\",\n \"settings\": {\n \"duration\": 10,\n \"resolution\": \"1080p\",\n \"aspect_ratio\": \"16:9\"\n },\n \"options\": {\n \"callback_url\": \"\",\n \"external_task_id\": \"\",\n \"watermark_info\": {\n \"enabled\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"id": "string",
"status": "submitted",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string"
}
}Authorizations
Body
application/json
Text prompt, which may contain both positive and negative descriptions.
- Up to 26,000 characters for pure English, 11,000 characters for pure non-English
- Mixed input must satisfy: English characters/26000 + non-English characters/11000 ≤ 1
- Describe the visual content, actions, camera movement, and event order
- To use images, videos, or elements as references, use the omni reference endpoint