Kling O1 Video 2 Video Edit Serverless API
Edit any video with precise natural language commands.
~246.93s
~$1.277
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
POST
https://api.segmind.com/v1/kling-o1-video-to-video-editParameters
promptrequiredstringEdit description. Use @Element1 to reference injected characters.
video_urlrequiredstring (uri)URL of the input video to edit
elementsoptionalstringElements with frontal and reference images for character replacement.
Default:
nullimage_urlsoptionalstring[]List of reference image URLs for context
keep_audiooptionalbooleanKeep the original audio from the input video
Default:
falseResponse 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