Kling 2.6 Serverless API
Transforms still images into immersive, cinematic videos with synchronized audio in seconds.
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) 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
https://api.segmind.com/v1/kling-2.6Parameters
promptrequiredstringGuides the scene. Try 'tranquil forest morning' for nature-themed visuals.
"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_ratiooptionalstringSets frame dimensions. Use '16:9' for widescreen.
"16:9""16:9""9:16""1:1"cfg_scaleoptionalnumberAdjusts style strength. Set to 0.8 for vivid details.
0.8Range: 0 - 1durationoptionalintegerDefines video length. Use '10' for longer scenes.
10510generate_audiooptionalbooleanIncludes music. Set to true for engaging audio.
trueimage_urloptionalstring (uri)Link to video background. Use scenic images for dramatic effects.
nullmodeoptionalstringControls output quality. Choose 'pro' for polished outcomes.
"pro""pro"negative_promptoptionalstringRemoves unwanted elements. Use 'no noise' for cleaner visuals.
"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.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out