Kling Edit-Video
Use the edit video endpoint to create an asynchronous Task.
Overview
Use the edit video endpoint with a supported model. Use the returned Task ID to retrieve its state, or provide callback_url for the deliveries documented below.
Quick start
- Create an API key and set it as RUNAPI_API_KEY.
- Choose a supported model and send a POST request whose body matches that model's schema.
- Store the returned task ID, then poll until a terminal state or handle the callbacks documented below.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_API_TOKEN
Supported models
Open a model page for current pricing, rate limits, and commercial-usage details.
Request schema
Fields and allowed values depend on the selected model. When supplied, callback_url receives the Task deliveries documented below.
kling-v3-omni-edit10 fields
aspect_ratiostringOutput aspect ratio; source-only requests require auto.
Allowed values:auto, 16:9, 9:16, 1:1
callback_urlstringWebhook URL for async notifications.
duration_secondsintegerOutput duration in seconds.
Allowed values:3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Default: 5
enable_soundbooleanEnable synchronized sound generation.
Default:false
modelstringModel slug.
output_resolutionstringOutput resolution.
Allowed values:720p, 1080p, 4k
Default: 720p
promptstringVideo description.
Range:1 - 2500
reference_image_urlsarrayOrdered reference image URLs.
Item range:1 - 4
source_task_idstringCompleted compatible task ID; cannot be combined with source_video_url.
source_video_urlstringPublic source video URL; cannot be combined with source_task_id.
kling-v3-omni-reference10 fields
aspect_ratiostringOutput aspect ratio; source-only requests require auto.
Allowed values:auto, 16:9, 9:16, 1:1
callback_urlstringWebhook URL for async notifications.
duration_secondsintegerOutput duration in seconds.
Allowed values:3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Default: 5
enable_soundbooleanEnable synchronized sound generation; source-video requests require false.
Default:false
modelstringModel slug.
output_resolutionstringOutput resolution.
Allowed values:720p, 1080p, 4k
Default: 720p
promptstringVideo description.
Range:1 - 2500
reference_image_urlsarrayOrdered reference image URLs.
Item range:1 - 4
source_task_idstringCompleted compatible task ID; cannot be combined with source_video_url.
source_video_urlstringPublic source video URL; cannot be combined with source_task_id.
Conditional rules
These requirements apply when all listed conditions match.
-
When
model = kling-v3-omni-edit,source_task_id = {"present" => false},source_video_url = {"present" => false}- Required
- Not accepted
-
When
model = kling-v3-omni-edit,source_video_url = {"present" => true}- Required
- Not accepted
source_task_id
-
When
model = kling-v3-omni-edit,source_task_id = {"present" => true}- Required
- Not accepted
source_video_url
-
When
model = kling-v3-omni-edit,reference_image_urls = {"present" => false},source_video_url = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-edit,reference_image_urls = {"present" => false},source_task_id = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-edit,reference_image_urls = {"present" => true},source_video_url = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-edit,reference_image_urls = {"present" => true},source_task_id = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-reference,source_task_id = {"present" => false},source_video_url = {"present" => false}- Required
- Not accepted
-
When
model = kling-v3-omni-reference,source_video_url = {"present" => true}- Required
- Not accepted
source_task_id
-
When
model = kling-v3-omni-reference,source_task_id = {"present" => true}- Required
- Not accepted
source_video_url
-
When
model = kling-v3-omni-reference,reference_image_urls = {"present" => false},source_video_url = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-reference,reference_image_urls = {"present" => false},source_task_id = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-reference,reference_image_urls = {"present" => true},source_video_url = {"present" => true}- Required
aspect_ratio- Not accepted
-
When
model = kling-v3-omni-reference,reference_image_urls = {"present" => true},source_task_id = {"present" => true}- Required
aspect_ratio- Not accepted
Create acceptance
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"task_replayed": {
"type": "boolean"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Polling processing
GET /api/v1/kling/edit_video/:id
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Polling completed
GET /api/v1/kling/edit_video/:id
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
Polling failed
GET /api/v1/kling/edit_video/:id
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
Customer callback: completed
POST callback_url
Response schema
{
"properties": {
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
Customer callback: failed
POST callback_url
Response schema
{
"properties": {
"error": {
"oneOf": [
{
"type": "string"
},
{
"properties": {
"code": {
"type": "string"
},
"limit_cents": {
"type": "integer"
},
"message": {
"type": "string"
},
"reset_at": {
"format": "date-time",
"type": [
"string",
"null"
]
},
"used_cents": {
"type": "integer"
},
"window": {
"enum": [
"1h",
"1d",
"7d",
"daily",
"weekly",
"monthly",
"lifetime"
],
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
]
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Authentication required"
}
Errors
GET /api/v1/kling/edit_video/:id
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Authentication required"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"oneOf": [
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Human-readable validation summary.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Response example
{
"error": "model must be one of: kling-v3-omni-edit, kling-v3-omni-reference"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Insufficient balance"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "API key credit limit exceeded"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "The request uses features that are not supported for the selected model"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Rate limit reached. Please retry later."
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Service under maintenance, please try again later"
}
Errors
POST /api/v1/kling/edit_video
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "The request timed out"
}
Errors
GET /api/v1/kling/edit_video/:id
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Task with id 'tsk_reference_demo' not found"
}
Generated Code Samples
Use cURL directly, or install an SDK for your language. Each sample submits the validated request shown in this reference.
Install
pip install runapi-kling
import os
from runapi.kling import KlingClient
client = KlingClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.edit_video.create(
model="kling-v3-omni-edit",
prompt="Turn the source into a hand-painted watercolor scene.",
source_video_url="https://cdn.runapi.ai/public/samples/video.mp4",
reference_image_urls=["https://cdn.runapi.ai/public/samples/image.jpg"],
duration_seconds=8,
output_resolution="1080p",
enable_sound=True,
aspect_ratio="16:9"
)