Kling O1 Video 2 Video Edit Serverless API
Kling Video O1 revolutionizes video editing through natural language commands for seamless, high-quality content creation.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/kling-o1-video-to-video-edit"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "change the background of the video with the background in @image1 maintain the character as it is.",
12 "video_url": "https://segmind-inference-inputs.s3.amazonaws.com/c511b717-f9dd-4624-8b8d-8f5a0f688a5d-3044799-hd_1280_720_24fps (1).mp4",
13 "image_urls": [
14 "https://www.shutterstock.com/image-photo/nicely-decorated-pergola-pots-blue-600nw-507200902.jpg"
15 ],
16 "keep_audio": false
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) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/kling-o1-video-to-video-edit"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "change the background of the video with the background in @image1 maintain the character as it is.",
12 "video_url": "https://segmind-inference-inputs.s3.amazonaws.com/c511b717-f9dd-4624-8b8d-8f5a0f688a5d-3044799-hd_1280_720_24fps (1).mp4",
13 "image_urls": [
14 "https://www.shutterstock.com/image-photo/nicely-decorated-pergola-pots-blue-600nw-507200902.jpg"
15 ],
16 "keep_audio": false
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
https://api.segmind.com/v1/kling-o1-video-to-video-editParameters
promptrequiredstringDescribe the edit. Use @Element1, @Element2 to reference elements. Example: 'Replace the character in the video with @Element1, maintaining the same movements'
video_urlrequiredstring (uri)URL of the input video to edit
elementsoptionalstringList of elements with reference and frontal images. Each element should have 'reference_image_urls' (list) and 'frontal_image_url' (str)
nullimage_urlsoptionalstring[]List of reference image URLs for context
keep_audiooptionalbooleanKeep the original audio from the input video
falseResponse 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