Kling O3 Video To Video Edit

Edit any video with text — swap backgrounds, inject characters, and restyle scenes using Kling O3's AI video-to-video model.

~222.74s
$0.945 - $6.30 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/kling-o3-video2video-edit"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Transform the scene into a cyberpunk neon-lit city at night, glowing neon signs, rain-soaked streets, futuristic atmosphere",
12    "video_url": "https://segmind-resources.s3.amazonaws.com/input/kling-o3-video2video-edit-source-video.mp4",
13    "mode": "pro",
14    "duration": "5",
15    "aspect_ratio": "16:9",
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-o3-video2video-edit

Parameters

promptrequired
string

Describe the edit. Use @Element1, @Element2 for elements and @Image1, @Image2 for reference images.

video_urlrequired
string (uri)

Input video to edit. Width must be 720-2160px.

aspect_ratiooptional
string

Set the aspect ratio for the output video.

Default: "16:9"
Allowed values :
"16:9""9:16""1:1"
durationoptional
string

Length of the output video in seconds.

Default: "5"
Allowed values (13 total):
"3""4""5""6""7""8""9""10""11""12"+3 more
elementsoptional
object[]

Character/object elements to include. Reference in prompt with @Element1, @Element2. Max 10 elements.

Array items:
frontal_image_urloptional
string (uri)

Frontal view image of the character or object.

reference_image_urlsoptional
string[]

Up to 3 reference images for this element.

image_urlsoptional
string[]

Reference image URLs for style or scene guidance. Reference in prompt as @Image1, @Image2.

keep_audiooptional
boolean

Keep original audio from the input video.

Default: false
modeoptional
string

Select quality mode. Standard for faster generation, Pro for higher quality.

Default: "pro"
Allowed values :
Standard"std"
Pro"pro"
shot_typeoptional
string

Camera shot type for the video.

Default: "customize"

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