Kling O1 Serverless API
Kling O1 transforms video creation and editing into a seamless, AI-driven experience for content creators.
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) 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
https://api.segmind.com/v1/kling-o1Parameters
image_urlsrequiredstring[]List URLs for reference images, using @Image1, @Image2 etc. for adjustments.
promptrequiredstringDescribe the desired output using image references like @Image1. Example: 'Combine @Image1 with elements in @Image2'.
"Merge @Image1 into the landscape of @Image2"aspect_ratiooptionalstringChoose frame dimensions; 'auto' for detection or specify ratios like 16:9.
"auto""auto""16:9""9:16""1:1"output_formatoptionalstringSelect output format. Use 'png' for best quality, 'jpg' for smaller files.
"png""png""jpg"resolutionoptionalstringSpecify the output resolution for images. Opt for '1K' for standard quality.
"1K""1K"Response Type
Returns: Image
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