Kling 2.6 Serverless API

Transforms still images into immersive, cinematic videos with synchronized audio in seconds.

~123.28s
$0.438 - $1.75 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/kling-2.6"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Visual: São Paulo, Brazil – a narrow street packed with vibrant murals in neon greens, reds, and yellows. The atmosphere is electric: street vendors, kids playing football, and local dancers vibing in the background. The city feels loud, alive, and unapologetic. Subject: A Black male rapper in raw streetwear — fitted cap, graphic tee, worn sneakers, simple chain. He stands front and center, locked in with the camera, body moving naturally to the rhythm, commanding the street like it’s his stage. Audio: [Male rapper, high-energy, gritty voice] Rapping over a hard street beat blended with Brazilian percussion: “Painted walls talk loud, yeah, they know my name, Came up from the block where the heat stay flame. City never soft, had to hustle, stay sharp, Turned struggle into fire, now I’m leavin’ my mark. Bass hit heavy, feel the ground when I step, From these streets to the world, yeah, I’m reppin’ respect.” Background: Heavy bass layered with live drum hits, claps, and subtle street noise — bikes passing, distant voices, raw urban texture. Camera: Rapid cuts between tight close-ups of his face and hands, wide shots of the colorful murals, quick flashes of dancers and street life. Handheld movement keeps it gritty and real, ending on a strong close-up as the beat hits.",
12    "negative_prompt": "no noise, no distortion, no clutter",
13    "cfg_scale": 0.8,
14    "duration": "10",
15    "mode": "pro",
16    "aspect_ratio": "16:9",
17    "generate_audio": true
18}
19
20response = requests.post(url, headers=headers, json=data)
21
22if response.status_code == 200:
23    result = response.json()
24    print(json.dumps(result, indent=2))
25else:
26    print(f"Error: {response.status_code}")
27    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/kling-2.6

Parameters

promptrequired
string

Guides the scene. Try 'tranquil forest morning' for nature-themed visuals.

Default: "Visual: São Paulo, Brazil – a narrow street packed with vibrant murals in neon greens, reds, and yellows. The atmosphere is electric: street vendors, kids playing football, and local dancers vibing in the background. The city feels loud, alive, and unapologetic. Subject: A Black male rapper in raw streetwear — fitted cap, graphic tee, worn sneakers, simple chain. He stands front and center, locked in with the camera, body moving naturally to the rhythm, commanding the street like it’s his stage. Audio: [Male rapper, high-energy, gritty voice] Rapping over a hard street beat blended with Brazilian percussion: “Painted walls talk loud, yeah, they know my name, Came up from the block where the heat stay flame. City never soft, had to hustle, stay sharp, Turned struggle into fire, now I’m leavin’ my mark. Bass hit heavy, feel the ground when I step, From these streets to the world, yeah, I’m reppin’ respect.” Background: Heavy bass layered with live drum hits, claps, and subtle street noise — bikes passing, distant voices, raw urban texture. Camera: Rapid cuts between tight close-ups of his face and hands, wide shots of the colorful murals, quick flashes of dancers and street life. Handheld movement keeps it gritty and real, ending on a strong close-up as the beat hits."
aspect_ratiooptional
string

Sets frame dimensions. Use '16:9' for widescreen.

Default: "16:9"
Allowed values :
"16:9""9:16""1:1"
cfg_scaleoptional
number

Adjusts style strength. Set to 0.8 for vivid details.

Default: 0.8Range: 0 - 1
durationoptional
integer

Defines video length. Use '10' for longer scenes.

Default: 10
Allowed values :
510
generate_audiooptional
boolean

Includes music. Set to true for engaging audio.

Default: true
image_urloptional
string (uri)

Link to video background. Use scenic images for dramatic effects.

Default: null
modeoptional
string

Controls output quality. Choose 'pro' for polished outcomes.

Default: "pro"
Allowed values :
"pro"
negative_promptoptional
string

Removes unwanted elements. Use 'no noise' for cleaner visuals.

Default: "no noise, no distortion, no clutter"

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out