Create Video From Image Frames
April 18, 2025
Table of contents
This endpoint generates a video from one or two images (start and end frames).
https://api.useapi.net/v1/kling/videos/image2video-frames
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]",
"image": "https://example.com/start-image.jpg",
"image_tail": "https://example.com/end-image.jpg",
"prompt": "A futuristic city with flying cars and tall buildings",
"negative_prompt": "people, low quality, distorted",
"cfg_scale": 0.5,
"duration": "5",
"model_name": "kling-v1-6",
"mode": "pro",
"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. -
image
is required ifimage_tail
is not provided. URL to the start frame image.
Images can be uploaded using POST /assets and the returned URLs can be used here. -
image_tail
is required ifimage
is not provided. URL to the end frame image.
Images can be uploaded using POST /assets. -
prompt
is optional, text description to guide the video generation.
Maximum length: 2500 characters. -
negative_prompt
is optional, what not to include in the generated video.
Maximum length: 2500 characters. -
cfg_scale
is optional, guidance scale for image-to-video generation.
Range:0
to1
. Default:0.5
. -
duration
is optional, length of the video in seconds.
Options:5
(default) or10
. -
model_name
is optional, the AI model version to use.
Options:kling-v1-5
,kling-v1-6
(default),kling-v2-0
. -
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.
Notes:
- At least one of
image
orimage_tail
must be provided. - When using model_name
kling-v2-0
, the parameterscfg_scale
,image_tail
, andmode
are not supported. - If both
image
andimage_tail
are provided, the mode is automatically set topro
.
Responses
-
{ "id": 12345678, "created": 1712345678000, "status": "submitted", "status_final": false, "type": "m2v_img2video_hq", "taskInfo": { "inputs": [ { "name": "input", "url": "https://example.com/start-image.jpg" }, { "name": "tail_image", "url": "https://example.com/end-image.jpg" } ], "arguments": [ { "name": "prompt", "value": "A futuristic city with flying cars and tall buildings" }, { "name": "negative_prompt", "value": "people, low quality, distorted" }, { "name": "cfg", "value": 0.5 }, { "name": "duration", "value": "5" }, { "name": "kling_version", "value": "1.6" }, { "name": "tail_image_enabled", "value": "true" } ] }, "scheduled": true }
-
{ "error": "image or image_tail 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 ("input" or "tail_image")
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-frames" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{ "email": "[email protected]", "image": "https://example.com/start-image.jpg", "image_tail": "https://example.com/end-image.jpg", "prompt": "A futuristic city with flying cars and tall buildings", "negative_prompt": "people, low quality, distorted" }'
-
const token = "API token"; const email = "Previously configured account email"; const apiUrl = "https://api.useapi.net/v1/kling/videos/image2video-frames"; const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}`, }, body: JSON.stringify({ email: email, image: "https://example.com/start-image.jpg", image_tail: "https://example.com/end-image.jpg", prompt: "A futuristic city with flying cars and tall buildings", negative_prompt: "people, low quality, 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-frames" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } data = { "email": email, "image": "https://example.com/start-image.jpg", "image_tail": "https://example.com/end-image.jpg", "prompt": "A futuristic city with flying cars and tall buildings", "negative_prompt": "people, low quality, distorted" } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())