Kling O1 Video 2 Video Edit Serverless API

Kling Video O1 revolutionizes video editing through natural language commands for seamless, high-quality content creation.

~255.42s
~$1.3
 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

POSThttps://api.segmind.com/v1/kling-o1-video-to-video-edit

Parameters

promptrequired
string

Describe the edit. Use @Element1, @Element2 to reference elements. Example: 'Replace the character in the video with @Element1, maintaining the same movements'

video_urlrequired
string (uri)

URL of the input video to edit

elementsoptional
string

List of elements with reference and frontal images. Each element should have 'reference_image_urls' (list) and 'frontal_image_url' (str)

Default: null
image_urlsoptional
string[]

List of reference image URLs for context

keep_audiooptional
boolean

Keep the original audio from the input video

Default: false

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