Create Video From Multiple Images
April 18, 2025
Table of contents
This endpoint generates a video from multiple images (up to 4) that will appear as elements in the video.
https://api.useapi.net/v1/kling/videos/image2video-elements
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"email": "[email protected]",
"prompt": "A museum gallery with artwork on display",
"image_0": "https://example.com/image1.jpg",
"image_1": "https://example.com/image2.jpg",
"image_2": "https://example.com/image3.jpg",
"image_3": "https://example.com/image4.jpg",
"negative_prompt": "low quality, blurry, distorted",
"duration": "5",
"aspect_ratio": "16:9",
"model_name": "kling-v1-6",
"mode": "std",
"replyUrl": "https://your-callback-url.com/webhook",
"replyRef": "your-reference-id"
}
-
email
is optional when only one account configured.
However, if you have multiple accounts configured, this parameter becomes required. -
prompt
is required, text description of the video to generate.
Maximum length: 2500 characters. -
image_0
toimage_3
are URLs to images that will appear in the video. At least one image must be provided.
Images can be uploaded using POST /assets and the returned URLs can be used here. -
negative_prompt
is optional, what not to include in the generated video.
Maximum length: 2500 characters. -
duration
is optional, length of the video in seconds.
Options:5
(default) or10
. -
aspect_ratio
is optional, the video aspect ratio.
Options:16:9
(default),9:16
,1:1
. -
model_name
is optional, the AI model version to use.
Options:kling-v1-5
,kling-v1-6
(default). Note:kling-v2-0
is not supported for this endpoint. -
mode
is optional, quality level.
Options:std
(standard, default) orpro
(higher quality, slower generation). -
maxJobs
is optional, range from1
to10
.
Specifies the maximum number of concurrent jobs. -
replyUrl
is optional, a callback URL to receive results when completed. -
replyRef
is optional, a reference identifier for the callback.
Note: At least one of image_0
, image_1
, image_2
, or image_3
must be provided.
Responses
-
{ "id": 12345678, "created": 1712345678000, "status": "submitted", "status_final": false, "type": "m2v_img2video", "taskInfo": { "inputs": [ { "name": "ref_img_0", "url": "https://example.com/image1.jpg" }, { "name": "raw_ref_img_0", "url": "https://example.com/image1.jpg" }, { "name": "ref_img_1", "url": "https://example.com/image2.jpg" }, { "name": "raw_ref_img_1", "url": "https://example.com/image2.jpg" } ], "arguments": [ { "name": "prompt", "value": "A museum gallery with artwork on display" }, { "name": "negative_prompt", "value": "low quality, blurry, distorted" }, { "name": "duration", "value": "5" }, { "name": "aspect_ratio", "value": "16:9" }, { "name": "kling_version", "value": "1.6" }, { "name": "imageList", "value": "[{\"top\":0,\"left\":0,\"width\":1,\"height\":1},{\"top\":0,\"left\":0,\"width\":1,\"height\":1}]" } ] }, "scheduled": true }
-
{ "error": "At least one image (image_0, image_1, image_2 or image_3) is required" }
-
{ "error": "Unauthorized", "code": 401 }
When successful, the response includes a task ID which can be used to check the status using GET /tasks/{task_id}.
Model
{ // TypeScript, all fields are optional
id: number // Task ID
created: number // Creation timestamp in milliseconds
status: string // Task status: "submitted", "processing", "failed", or "succeed"
status_final: boolean // Whether this is the final status of the task
type: string // Task type ("m2v_img2video" or "m2v_img2video_hq")
taskInfo: {
inputs: Array<{
name: string // Input name (ref_img_0, raw_ref_img_0, etc.)
url: string // Input URL
}>
arguments: Array<{
name: string // Argument name
value: string // Argument value
}>
}
scheduled: boolean // Whether the task is scheduled
}
Examples
-
curl -X POST "https://api.useapi.net/v1/kling/videos/image2video-elements" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{ "email": "[email protected]", "prompt": "A museum gallery with artwork on display", "image_0": "https://example.com/image1.jpg", "image_1": "https://example.com/image2.jpg", "negative_prompt": "low quality, blurry, distorted" }'
-
const token = "API token"; const email = "Previously configured account email"; const apiUrl = "https://api.useapi.net/v1/kling/videos/image2video-elements"; const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}`, }, body: JSON.stringify({ email: email, prompt: "A museum gallery with artwork on display", image_0: "https://example.com/image1.jpg", image_1: "https://example.com/image2.jpg", negative_prompt: "low quality, blurry, distorted" }) }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" email = "Previously configured account email" apiUrl = "https://api.useapi.net/v1/kling/videos/image2video-elements" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } data = { "email": email, "prompt": "A museum gallery with artwork on display", "image_0": "https://example.com/image1.jpg", "image_1": "https://example.com/image2.jpg", "negative_prompt": "low quality, blurry, distorted" } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())