Kling AI 1.6 Text to Video Serverless API

Kling AI 1.6 Text-to-Video is a cutting-edge AI tool that transforms text into stunning, lifelike videos. Create professional-quality content effortlessly with Kling AI's advanced capabilities.

~304.08s
$0.560 - $1.96 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/kling-1.6-text2video"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "a scene shows a shitzu puppy walking through long grass",
12    "negative_prompt": "No buildings, no artificial objects",
13    "cfg_scale": 0.5,
14    "mode": "std",
15    "aspect_ratio": "16:9",
16    "duration": "5"
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22    result = response.json()
23    print(json.dumps(result, indent=2))
24else:
25    print(f"Error: {response.status_code}")
26    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/kling-1.6-text2video

Parameters

promptrequired
string

Text prompt to describe the desired image

Default: "a scene shows a shitzu puppy walking through long grass"
aspect_ratiooptional
string

Aspect ratio of the output image

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

CFG scale to control how closely the image matches the prompt (range 0-1)

Default: 0.5Range: 0 - 1
durationoptional
integer

Duration of the output in seconds

Default: 5
Allowed values :
510
modeoptional
string

std: Standard Mode, generates videos faster and has lower inference costs. pro: currently does not support professional mode

Default: "std"
Allowed values :
"std"
negative_promptoptional
string

Description of unwanted elements

Default: "No buildings, no artificial objects"

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