Skip to main content
Kling 4.0 supports text-to-video, keyframe-based image-to-video, and Omni reference generation/editing. Its API currently exposes 720p and 1080p, not 4k. Kling 4.0 Flash is a separate offering and is not implied by this model ID. Authenticate with a MixRoute Bearer key. Put kling-4.0 in the endpoint path, not a body model field. Keep the native prompt/contents, settings and options structure; do not wrap it in metadata. These endpoints do not establish support for Kling 4.0 on motion-control.

Model specifications

Shared settings and options

English-only: up to 26,000 characters; non-English-only: up to 11,000. Mixed input must satisfy E / 26000 + N / 11000 <= 1. Describe action order and camera movement in the prompt; do not copy the older multi_shot switch. E is the number of English characters and N is the number of non-English characters.
Text/image endpoints have no 4.0 audio or multi_shot switch. Omit settings.audio and settings.multi_shot rather than sending the older audio=off configuration.

Text-to-video

Set MIXROUTE_API_KEY. Replace example.com media URLs with accessible files. Submit once; a timeout is not proof that a task was not created.

Image-to-video

Use a prompt item plus first_frame, middle_frame and/or last_frame image items. Each image uses url; an optional unique id lets the prompt refer to it as @id. Keep keyframes and prompt references in timeline order. No timestamp field is required by this schema. At most 10 images. JPG/JPEG/PNG, at most 30 MB each, both dimensions at least 300 px, aspect ratio 2:5 to 5:2. Use public URLs or Base64. Image-to-video has no settings.aspect_ratio; use Omni for videos, Elements or voice references.

Omni reference and editing

A prompt item is required. Supported inputs: first_frame, middle_frame, last_frame, refer_image, feature_video, base_video, element and voice. Image/video items use url; Elements use element_id and voices use voice_id. Assign unique id values and refer to them as @id; element/voice IDs must be accessible to the routed upstream account. For element and voice items, id is required as well as element_id or voice_id. Image id is required when multiple middle_frame or refer_image inputs are provided to Omni. If first_frame, last_frame and refer_image are combined, put the first frame first and last frame last among the image items.

Media limits

Combined images, videos, Elements and voices: at most 15 inputs. Images: at most 10. Reference videos: at most 5, counting video-character Elements toward that limit. Elements: at most 7, including at most 3 video-character Elements. Voices: at most 3. At most one base_video. JPG/JPEG/PNG, at most 30 MB per image, both dimensions at least 300 px, aspect ratio 2:5 to 5:2. Use public URLs or Base64. MP4/MOV, at most 300 MB each; each video and the combined video duration must be 3-30 seconds, including video-character Elements. Dimensions 700-4553 px, total pixels at most 8,294,400; aspect ratio 2:5 to 5:2; input 24-60 fps, output 24 fps.

Task results

Check HTTP status and code=0, save submission data.id, and query that single MixRoute task ID. After succeeded, read the video URL from data[0].outputs where type=video. Keep API keys away from the result CDN.
Task results For Kling 4.0, upstream billing distinguishes input_duration and output_duration; input includes reference videos and video-character Elements. Gateway usage may be absent or empty. Do not infer final MixRoute charges solely from outputs[].duration or apply older model rates. Use the Model Marketplace and console bill.