APIMaster.ai

Kling V4 Video API

Kling V4 text, image and reference video generation, editing and extension. Complete parameters, asynchronous results, per-second billing and refunds.

Kling V4

Use kling-v4 for text-to-video, image-to-video, reference generation, video editing and video extension. Output is 720p or 1080p, 3–30 seconds per generated segment, with a stereo audio track.

Base URL: https://apimaster.ai/v1. Provide a nonempty prompt in every mode. Prompt-free image generation is rejected on this route; describe the desired motion or camera movement. Authenticate every request with Authorization: Bearer YOUR_API_KEY. Media URLs must be publicly accessible without cookies or login.

Submit and retrieve

POST https://apimaster.ai/v1/videos/generations with Content-Type: application/json.

curl "https://apimaster.ai/v1/videos/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"kling-v4","prompt":"A paper boat drifts on a quiet pond, gentle ripples and water sounds.","duration":3,"resolution":"720p","aspect_ratio":"16:9"}'
{"id":"task_example","task_id":"task_example","object":"video","model":"kling-v4","status":"queued","created_at":1792756800}

A task ID confirms acceptance. Poll GET https://apimaster.ai/v1/videos/{task_id} every 10–20 seconds until status is completed or failed. A successful result contains an authenticated APIMaster video URL. Download promptly using the same API key:

curl "https://apimaster.ai/v1/videos/task_example" -H "Authorization: Bearer YOUR_API_KEY"
curl -L "https://apimaster.ai/v1/videos/task_example/content" \
  -H "Authorization: Bearer YOUR_API_KEY" -o kling-v4.mp4

Other states include queued and in_progress. On failure, read error.code and error.message; correct the request before submitting again. Successful videos can also be previewed and downloaded in console usage logs.

All request parameters

Field Type Required / default Description
model string required kling-v4
prompt string required, including image-to-video Desired scene, action, camera and sound. Use @Image1, @Video1, @Audio1 to refer to each media array in order. In editing, the input video is @Video1.
duration integer 5 Generated seconds, 3–30. For editing, omission follows input duration, rounded up and capped at 30. For extension, this is the new segment length.
resolution string 720p 720p or 1080p. There is no mode parameter.
aspect_ratio string mode-dependent 16:9, 9:16, 1:1, 21:9; reference generation also accepts auto. Text defaults to 16:9; image/edit follow their input; reference defaults to auto. Omit for extension.
image_urls string[] optional Image mode: first frame then optional last frame, maximum 2. Reference/edit: at most 10 reference images. Explicitly set omni_reference_task_type: "reference" for reference-image-only generation.
image_with_roles object[] optional Each object has url and role. See roles below. Do not mix image_urls and explicit frame fields in image mode.
image_with_roles[].url string required per item Public HTTP(S) image URL.
image_with_roles[].role string required per item first_frame, last_frame, keyframe (alias middle_frame), or reference_image.
first_frame_image string optional First-frame URL; alternative to the first image_urls item or a first_frame role.
last_frame_image string optional Last-frame URL for image generation, or target last frame for extension.
video_urls string[] optional Reference generation: up to 5 videos, up to 30 input seconds total. Edit/extend: exactly 1 video, with the corresponding explicit task type.
video_url string required for edit/extend unless video_urls supplied Input video. Requires explicit edit or extend. Do not send both singular and plural fields. Edit inputs must be at least 3 seconds; inputs longer than 30 seconds use the first 30 seconds.
audio_urls string[] optional, reference only Up to 3 reference audio clips, each 5–30 seconds.
omni_reference_task_type string auto auto, reference, edit, extend. Auto selects text/image/reference from the supplied inputs.
audio_setting string mode-dependent origin preserves source sound; auto generates new sound. Only edit or reference generation with video. Edit defaults to original sound; reference defaults to new sound. Not supported for extension.

Image roles: exactly 1 first frame, at most 1 last frame and 8 middle frames, at most 10 total. Reference generation supports at most 10 images, 5 videos, 3 audios, and 15 files combined. Use reference_image roles for reference generation. For editing, reference images use image_urls. Extension accepts only an optional target last frame in addition to its input video.

Compatibility aliases: seconds maps to duration, size maps to the resolution value (720p/1080p), and ratio maps to aspect_ratio. Conflicting aliases return HTTP 400. Prefer canonical fields above.

Examples for each mode

Image-to-video:

{"model":"kling-v4","prompt":"Slow camera movement, gentle motion.","image_urls":["https://example.com/start.png","https://example.com/end.png"],"duration":5}

Middle frames follow array order:

{"model":"kling-v4","prompt":"Animate smoothly through the supplied frames.","image_with_roles":[{"url":"https://example.com/start.png","role":"first_frame"},{"url":"https://example.com/middle.png","role":"keyframe"},{"url":"https://example.com/end.png","role":"last_frame"}],"duration":10}

Reference generation:

{"model":"kling-v4","prompt":"Animate @Image1 using the camera motion of @Video1 and the music of @Audio1.","image_with_roles":[{"url":"https://example.com/character.png","role":"reference_image"}],"video_urls":["https://example.com/camera.mp4"],"audio_urls":["https://example.com/music.mp3"],"omni_reference_task_type":"reference","aspect_ratio":"auto","duration":5}

Editing, following input duration and aspect ratio:

{"model":"kling-v4","prompt":"Change the scene to a snowy evening.","omni_reference_task_type":"edit","video_url":"https://example.com/input.mp4","image_urls":["https://example.com/style.png"],"audio_setting":"origin"}

Extension, returning the original video plus the new segment:

{"model":"kling-v4","prompt":"Continue the camera movement as evening falls.","omni_reference_task_type":"extend","video_url":"https://example.com/input.mp4","duration":5,"last_frame_image":"https://example.com/target.png"}

Example URLs are placeholders; replace them with real media.

Billing and refunds

Official base tariff (checked 2026-10-23)

The Kling developer pricing page, in its Balance display, publishes these preview rates. They are the model's base reference prices; use the live model card for your effective channel/account price. The official page marks direct API access as Coming Soon; APIMaster availability is shown on its own model card.

Variant Base USD / billable second
720p, no video input $0.157
1080p, no video input $0.235
720p, video input $0.094
1080p, video input $0.141

Prices are in USD per billable second; 720p and 1080p have separate rates. Editing and reference generation with video use the video-input tier. Check the live Kling V4 model card for current prices and available routes. Channel and account coefficients affect the final charge; usage logs show the actual amount.

Mode Billable seconds
Text, image, reference with only images/audio Generated output seconds
Extension New segment seconds, excluding the original video
Editing / reference with video Output seconds + max(output seconds, input video seconds)

Sum input video durations before rounding up, capped at 30 seconds. For example, editing a 3.04-second video without specifying duration yields a 4-second output and 8 billable seconds at the video-input rate. A 5-second extension of a 20-second video is billed for 5 seconds, even though the returned file contains 25 seconds.

The server measures input video duration before submission for editing/reference billing. If measurement fails, the request is rejected before generation is charged. Generation failures refund the reserved generation charge. Invalid requests are not charged. Refreshing or polling a completed task does not charge for generation again.

Unsupported parameters and troubleshooting

V4 always includes stereo audio. Omit mode, negative_prompt, multi_shot, multi_prompt, element_list, video_list, camera_control, voice_list, and other undocumented fields. audio: false and watermark: true are unsupported. audio: true and watermark: false are accepted compatibility values. Use audio_setting only where allowed.

Error Action
HTTP 400 / invalid parameter Check JSON types, media limits, task type and parameter combinations. duration is a JSON integer.
Input video duration cannot be measured Supply a public, downloadable MP4/MOV URL without authentication or anti-hotlink restrictions.
Input video supplied without edit/extend Use video_urls for reference mode, or explicitly select edit/extend for video_url.
HTTP 503 / pricing unavailable The selected variant is unavailable; check the model card.
Asynchronous generation failed Inspect task error, verify source media and retry with corrected inputs. The generation reservation is refunded.

Get an API key after registering, then use https://apimaster.ai/v1 with model kling-v4.