Generate video from text using kling-2.6/text-to-video
curl --request POST \
--url https://api.kie.ai/api/v1/jobs/createTask \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "kling-2.6/text-to-video",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \"360-degree flawless tailoring, slimming and versatile.\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \"Double-sided fleece fabric, $30 off immediately when you order now.\"",
"sound": false,
"aspect_ratio": "1:1",
"duration": "5"
}
}
EOFimport requests
url = "https://api.kie.ai/api/v1/jobs/createTask"
payload = {
"model": "kling-2.6/text-to-video",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \"360-degree flawless tailoring, slimming and versatile.\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \"Double-sided fleece fabric, $30 off immediately when you order now.\"",
"sound": False,
"aspect_ratio": "1:1",
"duration": "5"
}
}
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-2.6/text-to-video',
callBackUrl: 'https://your-domain.com/api/callback',
input: {
prompt: 'Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host\'s figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie\'s cut. [African female host, in a cheerful tone] says: "360-degree flawless tailoring, slimming and versatile." She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: "Double-sided fleece fabric, $30 off immediately when you order now."',
sound: false,
aspect_ratio: '1:1',
duration: '5'
}
})
};
fetch('https://api.kie.ai/api/v1/jobs/createTask', 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.kie.ai/api/v1/jobs/createTask",
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/text-to-video',
'callBackUrl' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => 'Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host\'s figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie\'s cut. [African female host, in a cheerful tone] says: "360-degree flawless tailoring, slimming and versatile." She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: "Double-sided fleece fabric, $30 off immediately when you order now."',
'sound' => false,
'aspect_ratio' => '1:1',
'duration' => '5'
]
]),
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.kie.ai/api/v1/jobs/createTask"
payload := strings.NewReader("{\n \"model\": \"kling-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\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.kie.ai/api/v1/jobs/createTask")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kie.ai/api/v1/jobs/createTask")
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-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_kling-2.6_1765182425861"
}
}Kling
Kling-2.6 - Text to Video
Generate high-quality videos from text descriptions with the advanced Kling-2.6 AI model
POST
/
api
/
v1
/
jobs
/
createTask
Generate video from text using kling-2.6/text-to-video
curl --request POST \
--url https://api.kie.ai/api/v1/jobs/createTask \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "kling-2.6/text-to-video",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \"360-degree flawless tailoring, slimming and versatile.\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \"Double-sided fleece fabric, $30 off immediately when you order now.\"",
"sound": false,
"aspect_ratio": "1:1",
"duration": "5"
}
}
EOFimport requests
url = "https://api.kie.ai/api/v1/jobs/createTask"
payload = {
"model": "kling-2.6/text-to-video",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"prompt": "Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \"360-degree flawless tailoring, slimming and versatile.\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \"Double-sided fleece fabric, $30 off immediately when you order now.\"",
"sound": False,
"aspect_ratio": "1:1",
"duration": "5"
}
}
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-2.6/text-to-video',
callBackUrl: 'https://your-domain.com/api/callback',
input: {
prompt: 'Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host\'s figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie\'s cut. [African female host, in a cheerful tone] says: "360-degree flawless tailoring, slimming and versatile." She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: "Double-sided fleece fabric, $30 off immediately when you order now."',
sound: false,
aspect_ratio: '1:1',
duration: '5'
}
})
};
fetch('https://api.kie.ai/api/v1/jobs/createTask', 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.kie.ai/api/v1/jobs/createTask",
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/text-to-video',
'callBackUrl' => 'https://your-domain.com/api/callback',
'input' => [
'prompt' => 'Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host\'s figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie\'s cut. [African female host, in a cheerful tone] says: "360-degree flawless tailoring, slimming and versatile." She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: "Double-sided fleece fabric, $30 off immediately when you order now."',
'sound' => false,
'aspect_ratio' => '1:1',
'duration' => '5'
]
]),
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.kie.ai/api/v1/jobs/createTask"
payload := strings.NewReader("{\n \"model\": \"kling-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\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.kie.ai/api/v1/jobs/createTask")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"kling-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kie.ai/api/v1/jobs/createTask")
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-2.6/text-to-video\",\n \"callBackUrl\": \"https://your-domain.com/api/callback\",\n \"input\": {\n \"prompt\": \"Scene: A fashion live-streaming sales setting, with clothes hanging on racks and the host's figure reflected in a full-length mirror. Lines: [African female host] turns around to showcase the hoodie's cut. [African female host, in a cheerful tone] says: \\\"360-degree flawless tailoring, slimming and versatile.\\\" She then [African female host] leans closer to the camera. [African female host, in a lively tone] says: \\\"Double-sided fleece fabric, $30 off immediately when you order now.\\\"\",\n \"sound\": false,\n \"aspect_ratio\": \"1:1\",\n \"duration\": \"5\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_kling-2.6_1765182425861"
}
}Query Task Status
After submitting a task, you can check the task progress and retrieve generation results via the unified query endpoint:Get Task Details
Learn how to query task status and obtain generation results
In production environments, it is recommended to use the
callBackUrl parameter to receive automatic notifications upon generation completion, rather than polling the status endpoint.Related Resources
Market Overview
Browse all available models
Common API
Check account credits and usage status
Authorizations
All APIs require authentication via Bearer Token.
Obtaining an API Key:
- Visit the API Key Management Page to get your API Key
Usage Method: Add the following to the request header: Authorization: Bearer YOUR_API_KEY
Notes:
- Keep your API Key secure and do not disclose it to others
- If you suspect your API Key has been compromised, reset it immediately in the management page
Body
application/json
Name of the model used for the generation task. Required field.
- This endpoint must use the
kling-2.6/text-to-videomodel
Available options:
kling-2.6/text-to-video Example:
"kling-2.6/text-to-video"
Callback URL to receive notifications when the generation task is completed. Optional configuration, recommended for production environments.
- After the task is completed, the system will POST the task status and results to this URL
- The callback content includes the generated resource URL and task-related information
- Your callback endpoint must support receiving POST requests with JSON payloads
- You can also choose to call the task details endpoint to actively poll the task status
- To ensure callback security, see Webhook Verification Guide for signature verification implementation
Example:
"https://your-domain.com/api/callback"
Input parameters for the generation task
Show child attributes
Show child attributes
Response
Request Successful
Response Status Code
- 200: Success - Request processed successfully
- 401: Unauthorized - Authentication credentials missing or invalid
- 402: Insufficient Credits - Account has insufficient credits to perform the operation
- 404: Not Found - The requested resource or endpoint does not exist
- 422: Validation Error - Request parameters failed validation
- 429: Rate Limit Exceeded - Exceeded the request frequency limit for the resource
- 455: Service Unavailable - System is under maintenance
- 500: Server Error - Unexpected failure occurred while processing the request
- 501: Generation Failed - Content generation task execution failed
- 505: Function Disabled - The requested function is temporarily unavailable
Available options:
200, 401, 402, 404, 422, 429, 455, 500, 501, 505 Response message; error description if the request fails
Example:
"success"
Show child attributes
Show child attributes
