1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/kling-3-pro-image2video";
const data = {
"start_image_url": "toB64('https://segmind-resources.s3.amazonaws.com/input/75757e4c-7bb1-4e7f-8949-2bf8feaca736-seedance-med.jpg')",
"prompt": "Create a serene flowing river scene",
"negative_prompt": "noise, flicker",
"end_image_url": "toB64('')",
"duration": 5,
"aspect_ratio": "16:9",
"cfg_scale": 0.5,
"generate_audio": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Image URL to animate. High-resolution images yield clearer results.
Describe motion in video. Use dynamic verbs like dance or flow.
Elements to avoid in animation output. Use for noise or flicker.
URL of the final image frame. Suggested: Use for controlled motion transitions.
Length of the video in seconds. Choose longer for more detailed scenes.
Allowed values:
min : 3,
max : 4
Set the aspect ratio for the video. For social media, select '9:16'.
Allowed values:
Adjust prompt adherence. Increase for precise motion depiction.
min : 0,
max : 1
Enable for synchronized audio output. Recommended for immersive experiences.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Kling 3.0 is a generative image-to-video model that turns a starting image into a cinematic-quality 1080p animation, with an option to produce native, synchronized audio. It’s designed for developers building video generation features—like motion from stills, animated product shots, and stylized clips—while maintaining strong prompt control over how the scene moves.
On platforms like fal.ai, Kling is known for narrative-friendly generation (including multi-shot workflows and element consistency). On Segmind, this endpoint focuses on a practical workflow: animate a provided start frame, optionally guide motion with a prompt, and (if needed) constrain the transition with an end frame.
start_image_url (required)end_image_url for controlled transitionsduration)16:9, 9:16, 1:1cfg_scale (0–1)generate_audio9:16)negative_prompt (advanced) to reduce artifacts: try “noise, flicker, jitter, warping.”cfg_scale higher when motion must match the prompt; lower if output feels rigid or overfit.end_image_url when you need a clear start → end transformation (e.g., pose change).generate_audio for immersive clips; keep it off for silent UI/background loops.Is Kling 3.0 text-to-video or image-to-video?
This Segmind endpoint is image-to-video (requires start_image_url).
How do I generate 9:16 vertical video?
Set aspect_ratio to 9:16 and compose prompts with “portrait framing” cues.
What duration works best?
Start with 5–8 seconds. Use longer durations for slower camera moves and richer motion beats.
What does cfg_scale do?
It controls prompt adherence. Higher = more literal motion; lower = more interpretive animation.
How do I reduce flicker and artifacts?
Use negative_prompt (e.g., “flicker, noise”) and avoid overly complex motion in one prompt.