Kling V2.1 Master
curl --request POST \
--url https://whollyapi.com/api/v1/jobs/createTask \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"image_url": "<string>",
"duration": "<string>",
"negative_prompt": "<string>",
"cfg_scale": "<string>"
}
}
'import requests
url = "https://whollyapi.com/api/v1/jobs/createTask"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"image_url": "<string>",
"duration": "<string>",
"negative_prompt": "<string>",
"cfg_scale": "<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: '<string>',
input: {
prompt: '<string>',
image_url: '<string>',
duration: '<string>',
negative_prompt: '<string>',
cfg_scale: '<string>'
}
})
};
fetch('https://whollyapi.com/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://whollyapi.com/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' => '<string>',
'input' => [
'prompt' => '<string>',
'image_url' => '<string>',
'duration' => '<string>',
'negative_prompt' => '<string>',
'cfg_scale' => '<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://whollyapi.com/api/v1/jobs/createTask"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\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://whollyapi.com/api/v1/jobs/createTask")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whollyapi.com/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\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"taskId": "<string>"
}
}Kling
Kling V2.1 Master
POST
/
api
/
v1
/
jobs
/
createTask
Kling V2.1 Master
curl --request POST \
--url https://whollyapi.com/api/v1/jobs/createTask \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"image_url": "<string>",
"duration": "<string>",
"negative_prompt": "<string>",
"cfg_scale": "<string>"
}
}
'import requests
url = "https://whollyapi.com/api/v1/jobs/createTask"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"image_url": "<string>",
"duration": "<string>",
"negative_prompt": "<string>",
"cfg_scale": "<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: '<string>',
input: {
prompt: '<string>',
image_url: '<string>',
duration: '<string>',
negative_prompt: '<string>',
cfg_scale: '<string>'
}
})
};
fetch('https://whollyapi.com/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://whollyapi.com/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' => '<string>',
'input' => [
'prompt' => '<string>',
'image_url' => '<string>',
'duration' => '<string>',
'negative_prompt' => '<string>',
'cfg_scale' => '<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://whollyapi.com/api/v1/jobs/createTask"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\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://whollyapi.com/api/v1/jobs/createTask")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whollyapi.com/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\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"image_url\": \"<string>\",\n \"duration\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"cfg_scale\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"taskId": "<string>"
}
}Generate videos from a source image using the
Use the returned
kling/v2-1-master-image-to-video model.
Authentication
All API requests require a Bearer Token.Authorization: Bearer YOUR_API_KEY
Create a Video Generation Task
Submit an image-to-video generation task using the endpoint below.POST /api/v1/jobs/createTask
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model used for video generation. |
input | object | Yes | Input parameters for the video generation task. |
string
required
Must be
kling/v2-1-master-image-to-video.object
required
Input Parameters
Theinput object contains the parameters used to generate the video.string
required
The
prompt describes the video you want to generate.Maximum length: 5000 characters.Source Image
string
required
The
image_url must contain the URL of an uploaded image.Supported image formats:image/jpegimage/png
10 MBstring
Use
duration to specify the length of the generated video.Supported values:"5""10"
"5"string
Use
negative_prompt to exclude specific elements or qualities from the generated video.Maximum length: 500 characters.string
The
cfg_scale parameter controls how closely the model follows your prompt.| Setting | Value |
|---|---|
| Minimum | 0 |
| Maximum | 1 |
| Step | 0.1 |
| Default | 0.5 |
Example Request
{
"model": "kling/v2-1-master-image-to-video",
"input": {
"prompt": "A team of paratroopers descends into enemy territory, as they pass through clouds, the camera switches to a slow pan above the battlefield lighting up with...",
"image_url": "https://demo.com/1755256297923.png",
"duration": "5",
"negative_prompt": "blur, distort, and low quality",
"cfg_scale": 0.5
}
}
Response
Successful Response
A successful request returns a task ID.number
Response status code.
string
Response message. Contains the error description when the request fails.Example:
successobject
required
The task data object containing task id.
string
required
The unique identifier for this task.Example:
task_123456taskId with the Get Task Details endpoint to check task progress and retrieve the generation results.
Get Task Details
Learn how to query task status and retrieve generation results.
Error Response
{
"code": 500,
"msg": "Server Error - An unexpected error occurred while processing the request",
"data": null
}
API Response Codes
| Code | Status | Description |
|---|---|---|
200 | Success | Request processed successfully. |
401 | Unauthorized | Authentication credentials are missing or invalid. |
402 | Insufficient Credits | The account does not have enough credits to perform the operation. |
404 | Not Found | The requested resource or endpoint does not exist. |
422 | Validation Error | Request parameters failed validation checks. |
429 | Rate Limited | The request limit has been exceeded for this resource. |
433 | Request Limit | Sub-key usage exceeds the allowed limit. |
455 | Service Unavailable | The system is currently undergoing maintenance. |
500 | Server Error | An unexpected error occurred while processing the request. |
501 | Generation Failed | The content generation task failed. |
505 | Feature Disabled | The requested feature is currently disabled. |
