DataEyesAI
Official SiteConsoleDocs HomeGetting StartedDeveloper ToolsAI Models API
Terms & Policies
Official SiteConsoleDocs HomeGetting StartedDeveloper ToolsAI Models API
Terms & Policies
  1. Kling AI Video Generation
  • API Overview
  • Chat Completions
  • Responses
  • Messages (Claude)
  • Gemini (generateContent)
  • Embeddings
  • Image Models
    • Images
    • Gemini Image Generation
    • Grok Imagine Image
  • Midjourney format
    • Midjourney API Reference
    • Task query interface
    • Upload image
    • Get seed (Seed)
    • Submit Imagine task
    • Query tasks based on ID list
    • FaceSwap
    • Execute Action operation
    • /mj/submit/blend
    • Submit Describe task
    • Submit Modal
    • Refresh link
    • Edit image
    • Query task status by task ID
    • Get the seed of the task image
  • Video Model
    • FLUX Video Generation (flux-3-video)
    • Grok Video Generation
      • 00-Overview
      • 01-Text-to-Video
      • 02-Image-to-Video
      • 03-Reference-to-Video
      • 04-Video-Editing
      • 05-Video-Extension
    • Seedance Video Generation
      • 00-Overview
      • 01-Create-Video-Generation-Task
      • 02-Query-Video-Generation-Task
      • 03-Query-Video-Generation-Task-List
      • 04-Cancel-or-Delete-Task
      • Seedance Private Asset Library API Documentation
    • MiniMax-H3 Video Generation
      • 00-Overview
      • 01-Create-Video-Generation
      • 02-Create-Video-Regeneration
      • 03-Create-H3-Context-IR
      • 04-Query-Task
      • 05-List-Tasks
      • 06-Cancel-or-Delete-Task
    • Hailuo Video Generation
      • 00-Overview
      • 01-Text-to-Video-T2V
      • 02-Image-to-Video-I2V
      • 03-First-Last-Frame-FL2V
      • 04-Subject-Reference-S2V
      • 05-Query-Task-Status
      • 06-Video-Download
      • 99-Appendix-Camera-Movement-and-Webhooks
    • Jimeng Video Generation
      • 00-Overview
      • 01-3.0-Pro-Video-Generation
      • 02-720P-Text-to-Video
      • 03-720P-Image-to-Video-First-Frame
      • 04-720P-Image-to-Video-Start-End-Frame
      • 05-720P-Image-to-Video-Camera
      • 06-1080P-Text-to-Video
      • 07-1080P-Image-to-Video-First-Frame
      • 08-1080P-Image-to-Video-Start-End-Frame
      • 09-Error-Codes
    • Kling AI Video Generation
      • 00-Overview
      • 01-Text-to-Video
      • 02-Image-to-Video
      • 03-Omni-Video
      • 04-Multi-Image-to-Video
      • 05-Motion-Control
      • 06-Multi-Elements
      • 07-Video-Extension
      • 08-Lip-Sync
      • 09-Avatar
      • 10-Text-to-Audio
      • 11-Video-to-Audio
      • 12-TTS
      • 13-Custom-Voices
      • 14-Image-Recognition
      • 15-Element-Management
      • 16-Video-Effects
      • 17-Kling-4.0-Video-Generation
    • Vidu Video Generation
      • 00-Overview
      • 01-Text-to-Video
      • 02-Image-to-Video
      • 03-Reference-to-Video
      • 04-Start-End-Frame
      • 05-Multi-Frame
      • 06-Scene-Template
      • 07-Template-Story
      • 08-Query-Tasks
    • HappyHorse
      • HappyHorse Text-to-Video
      • HappyHorse Image-to-Video (First Frame)
      • HappyHorse Reference-to-Video
      • HappyHorse Video Editing
    • Wan Video Generation
      • 00-Overview.md
      • 01-Text-to-Video
      • 02-Image-to-Video
      • 03-Reference-to-Video
      • 04-Video-Editing
      • 05-First-Last-Frame-to-Video
      • 06-Motion-Transfer-and-Character-Swap
      • 07-Digital-Human-Video
      • 08-VACE-Video-Editing
      • 09-Query-Task
  • Audio API
    • Audio API
    • Gemini TTS API
    • Google DeepMind Lyria API
    • Elevenlabs Speech to Text API Reference
  1. Kling AI Video Generation

17-Kling-4.0-Video-Generation

Kling 4.0 Video Generation#

Kling 4.0 comes in two models:
ModelResolutionDuration (s)Notes
kling-4.0720p, 1080p (default)3–30Supports first, middle, and last frames, reference images and videos, elements, and voices
kling-4.0-flash720p3–20Faster and cheaper; omni reference does not support middle or last frames or voices
Kling 4.0 uses Kling's new API, with the model name in the path. It differs from the /kling/v1/... endpoints on the other pages in this folder. Add /kling after this site's domain and append the official new-API path.
EndpointMethodURL
Text to videoPOSThttps://studio.dataeyes.ai/kling/text-to-video/{model}
Image to video (first frame)POSThttps://studio.dataeyes.ai/kling/image-to-video/{model}
Omni reference to videoPOSThttps://studio.dataeyes.ai/kling/omni-video/{model}
Retrieve tasksGEThttps://studio.dataeyes.ai/kling/tasks?task_ids={task ID}
Authentication: Authorization: Bearer sk-xxx. Video generation is asynchronous: the create call returns a task id; poll every 10 seconds or more until status is succeeded or failed.

Text to video#

Response:
{
  "code": 0,
  "message": "SUCCEED",
  "request_id": "f041e273-01d3-4df9-9f85-e8889a3e4368",
  "data": {
    "id": "950100470134604273",
    "status": "submitted",
    "message": "",
    "create_time": 1794553985376,
    "update_time": 1794553985376
  }
}
ParameterTypeRequiredDescription
promptstringYesDescribes the scene, actions, camera, and order of events. Up to 26,000 characters in English, or 11,000 non-English characters
settings.resolutionstringNoSee the model table above
settings.durationintegerNoDuration in seconds; see the model table above. If omitted, a duration stated in the prompt is used; otherwise 10 seconds
settings.aspect_ratiostringNo16:9 (default), 9:16, 1:1, 21:9
options.external_task_idstringNoYour own task ID, usable for retrieval; must be unique within your account
options.callback_urlstringNoCallback URL for task status changes
options.watermark_info.enabledbooleanNoAlso generate a watermarked result; default false

Image to video (first frame)#

Uses the image as the first frame; describe the following action and camera movement in the prompt.
contents must contain one prompt and one first_frame; the image can be a URL or Base64.
Images: jpg, jpeg, or png; up to 30 MB; width and height at least 300 px; aspect ratio between 2:5 and 5:2.
The aspect ratio follows the first frame; aspect_ratio is not supported. options is the same as for text to video.

Omni reference to video#

Combine a prompt, images, videos, elements, and voices in contents, and refer to each item with @id in the prompt. It can also edit an existing video (base_video).
contents[].typeFormatNotes
prompt{"type": "prompt", "text": "..."}Required; include one
first_frame / middle_frame / last_frame{"type": "...", "url": "...", "id": "..."}Keyframe images. middle_frame and last_frame are kling-4.0 only
refer_image{"type": "refer_image", "url": "...", "id": "image_1"}Reference image (scene, style, character, etc.)
feature_video{"type": "feature_video", "url": "...", "id": "video_1"}Reference video (motion, camera work, etc.)
base_video{"type": "base_video", "url": "...", "id": "video_1"}Video to edit; at most one
element{"type": "element", "element_id": "...", "id": "..."}Element; element_id is a Kling element ID
voice{"type": "voice", "voice_id": "...", "id": "..."}Voice; up to 3; kling-4.0 only
Limits: up to 10 images; up to 5 reference videos (including video character elements), each video and the total 3–30 seconds, mp4 / mov, up to 300 MB; up to 7 elements; images, videos, elements, and voices together up to 15. With several images, give each an id and state what each item is for in the prompt.
settings parameterDescription
resolutionSee the model table above
durationSee the model table above. If omitted, a duration in the prompt is used; with base_video, its duration; otherwise 10 seconds
aspect_ratioadaptive (default), 16:9, 9:16, 1:1, 21:9. With adaptive, the ratio comes from the prompt, then the video to edit, keyframes, and reference videos, in that order
audionative (default; generates matching sound) or original (keeps the input video's audio; needs an input video and cannot be combined with voices)

Retrieve tasks#

To query by your own ID, use ?external_task_ids=... instead. Use only one of the two; separate multiple IDs with commas.
Response (succeeded, url truncated):
{
  "code": 0,
  "message": "SUCCEED",
  "data": [
    {
      "id": "950100470134604273",
      "status": "succeeded",
      "outputs": [
        { "id": "950105024762894184", "type": "video", "url": "https://v4-fdl.kechuangai.com/…mp4?…", "duration": "3.041" }
      ],
      "usage": { "output_duration": "3" },
      "create_time": 1794553985376,
      "update_time": 1794554134838
    }
  ]
}
FieldDescription
statussubmitted, processing, succeeded, failed
outputs[].urlVideo URL; download and save it promptly. outputs[].duration is the actual video length
usage.output_durationBilled duration in seconds

Billing#

Billed by output duration (seconds) and resolution, based on usage.output_duration. See prices in the Model Hub and charges in Usage logs. Invalid parameters (for example 1080p with kling-4.0-flash) return an error and are not billed.
Previous
16-Video-Effects
Next
00-Overview