Skip to main content
POST
All three input modes use kling-4.0-flash. The API selects the generation path from the supplied media. Generation is asynchronous; query the platform task ID returned by submission.
Use a platform API key. Mainland China users can replace https://toapis.com with https://toapis.cn. Availability depends on the deployed channel configuration and account access.

Input modes

Request parameters

string
required
Authenticate with Bearer YOUR_API_KEY.
string
required
Always kling-4.0-flash. Do not change the model ID between modes.
string
required
Required, nonblank, at most 8000 Unicode characters. Describe the subject, action, camera and relationships between media.
integer
default:"5"
Integer from 3 to 20 seconds. Defaults to 5.
string
default:"720p"
Only 720p. Defaults to 720p.
string
auto, 16:9, 9:16, 1:1 or 21:9. Omission leaves the upstream default unchanged; send auto explicitly for automatic aspect ratio.
string[]
Reference image URL array, at most 10 images. Positions do not imply a first frame. Counts combine with reference image roles; use one representation per media item.
string[]
Reference video URL array, at most 5 videos combined with video_with_roles.
object[]
Each object has url and role. reference / reference_image means reference image; first_frame means the first frame. keyframe and last_frame are unsupported.
object[]
Each object has url and role. Supported roles: reference / reference_video.
object
Boolean keep_original_sound preserves reference video audio, for example {"keep_original_sound": true}. Use for reference videos only. First-frame mode rejects this key even when false.
string
Optional client business ID, stored with the task and accepted by the same query endpoint.

Media rules and validation

  • Use publicly accessible HTTP(S) media URLs without usernames or passwords. Upload local files with image upload or video upload. Do not send local paths or base64.
  • Reference mode allows up to 10 images and 5 videos. Plain arrays and explicit reference roles are combined; do not send the same media twice.
  • First-frame mode accepts exactly one first_frame image; keyframe and last_frame roles are rejected. The first frame is selected by role, not by plain image array positions.
  • First frame and reference media are mutually exclusive. Do not use legacy Kling mode, audio, video_list or Omni reference structures. audio_with_roles, metadata.elements and metadata.voices are unsupported.
  • Invalid specifications, roles, URLs, counts or mode combinations are rejected. Correct the returned error before retrying. This page does not promise file size, codec or input video duration limits; media must also satisfy upload service and upstream requirements.

Request examples

Text-to-video

Reference media

First frame

Submit a task

Task queries and billing

The response id is the platform task ID. Query it below instead of using the provider task_id. States include queued, in_progress, completed and failed. See video task status for the result schema and task webhooks for callbacks.
Defaults are 5 seconds / 720p. Set these explicitly to control output specifications. This page does not quote fixed prices or equate original audio preservation with legacy Sound billing. Account quotes and task usage / billing determine the actual charges.