Skip to main content
API Reference for kling/kling-video-o1, served by Comfy Router from Kling.

Quick start

Create a key in your Comfy workspace and export it as COMFY_API_KEY. The Python and TypeScript snippets use the Comfy SDKs (pip install comfy-sdk, npm install @comfyorg/sdk); the cURL snippet is the same call over raw HTTP. Model ID: kling/kling-video-o1 Endpoint: POST https://api.comfy.org/v2/models/kling/kling-video-o1

Schema

Input

string
The aspect ratio of the generated video frame (width:height). Required when first-frame reference or video editing features are not used.Possible values: 16:9, 9:16, 1:1
string (uri)
The callback notification address for the result of this task. If configured, the server will actively notify when the task status changes.Format: uri
string
default:"\"5\""
Video Length in seconds. When using video editing function (refer_type: base), output duration is the same as input video and this parameter is invalid.Possible values: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
object[]
Reference Element List based on element ID configuration.
integer
required
Element IDFormat: int64
string
Customized Task ID. Must be unique within a single user account.
object[]
Reference Image List. Can include reference images of the element, scene, style, etc., or be used as the first or last frame to generate videos.
string
Image Base64 encoding or image URL (ensure accessibility). Supported formats include .jpg/.jpeg/.png. File size cannot exceed 10MB. Width and height dimensions shall not be less than 300px, aspect ratio between 1:2.5 ~ 2.5:1.
string
Whether the image is in the first or last frame. first_frame is the first frame, end_frame is the last frame. Currently does not support only the end frame.Possible values: first_frame, end_frame
string
default:"\"pro\""
Video generation mode. std: Standard Mode, generating 720P videos, cost-effective. pro: Professional Mode, generating 1080P videos, higher quality video output.Possible values: pro, std
string
Model name. Omit it or send null when using Comfy Router; the model is selected by the request path. A supplied name must match that path.
object[]
Information about each storyboard, such as prompts and duration. Supports up to 6 storyboards, with a minimum of 1. Required when multi_shot is true and shot_type is customize.
string
Duration of this storyboard in seconds. Must not exceed total task duration and must not be less than 1. Sum of all storyboard durations equals total task duration.
integer
Shot sequence number
string
Prompt word for this storyboard. Maximum length 512 characters.
boolean
default:"false"
Whether to generate multi-shot video. When true, the prompt parameter is invalid. When false, the shot_type and multi_prompt parameters are invalid.
string
Text prompt words, which can include positive and negative descriptions. Must not exceed 2,500 characters. Can specify elements, images, or videos in the format <<<>>> such as <<element_1>>, <<<image_1>>>, <<<video_1>>>.
string
Storyboard method. Required when the multi_shot parameter is set to true.Possible values: customize, intelligence
string
default:"\"off\""
Whether sound is generated simultaneously when generating videos.Possible values: on, off
object[]
Reference Video list. Can be used as a reference video for feature or as a video to be edited, with the default being the video to be edited.
string
Whether to keep the video original sound. yes indicates retention, no indicates non retention.Possible values: yes, no
string
Reference video type. feature is the feature reference video, base is the video to be edited.Possible values: feature, base
string
required
URL of uploaded video. Only .mp4/.mov formats are supported. Duration between 3-10 seconds. Resolution must be between 720px and 2160px. Frame rates of 24-60 fps supported. Only 1 video can be uploaded, with size not exceeding 200MB.
object
Whether to generate watermarked results simultaneously. Custom watermark is not supported at this time.
boolean
true means generate watermark, false means do not generate.
Generated from the schema Router serves at GET /v2/models/kling/kling-video-o1/openapi.json, the same document it validates a call against before the request reaches the provider.

Output

integer
Error code
object
integer
Task creation time, Unix timestamp in milliseconds
string
The deduction units of task
string
Task ID
object
string
object
object[]
string
Total video duration in seconds
string
Generated video ID
string (uri)
URL for generated videoFormat: uri
string (uri)
URL for generated video with watermark, hotlink protection formatFormat: uri
string
Task StatusPossible values: submitted, processing, succeed, failed
string
Task status information, displaying the failure reason when the task fails
integer
Task update time, Unix timestamp in milliseconds
object
boolean
string
Error message
string
Request ID

Examples

Input

Output

Before you ship

The SDKs create an Idempotency-Key and reuse it for automatic retries. For manual retries, reuse the original key. Router can hold the connection for up to 10 minutes. When a request fails, Router sends an X-Comfy-Error-Type response header explaining why. A 422 means Router rejected the input before calling the provider. Download generated assets promptly because result URLs can expire.

Headers

Authentication, idempotency, request IDs, error buckets, retry pacing, spend limits.

Using the Router API

Model discovery, validation errors, retries, and billing.

Limitations

What Router does not do today, and what to use instead.