Kling O1 Serverless API

Kling O1 transforms video creation and editing into a seamless, AI-driven experience for content creators.

~59.29s
$0.035 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/kling-o1"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Merge @Image1 into the landscape of @Image2",
12    "resolution": "1K",
13    "aspect_ratio": "auto",
14    "output_format": "png"
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20    result = response.json()
21    print(json.dumps(result, indent=2))
22else:
23    print(f"Error: {response.status_code}")
24    print(response.text)

API Endpoint

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

Parameters

image_urlsrequired
string[]

List URLs for reference images, using @Image1, @Image2 etc. for adjustments.

promptrequired
string

Describe the desired output using image references like @Image1. Example: 'Combine @Image1 with elements in @Image2'.

Default: "Merge @Image1 into the landscape of @Image2"
aspect_ratiooptional
string

Choose frame dimensions; 'auto' for detection or specify ratios like 16:9.

Default: "auto"
Allowed values :
"auto""16:9""9:16""1:1"
output_formatoptional
string

Select output format. Use 'png' for best quality, 'jpg' for smaller files.

Default: "png"
Allowed values :
"png""jpg"
resolutionoptional
string

Specify the output resolution for images. Opt for '1K' for standard quality.

Default: "1K"
Allowed values :
"1K"

Response Type

Returns: Image

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