APIMaster.ai

Kling V4 Flash — Request fields and limits

APIMaster gateway contract for kling-v4-flash, checked 2026-11-07. Channel 317 supports text, first-frame, image/video reference, editing and extension. All output is 720p, 24 fps, 3–20 seconds; this is a separate model from Kling V4.

Kling V4 Flash

APIMaster gateway contract for kling-v4-flash, checked 2026-11-07. Channel 317 supports text, first-frame, image/video reference, editing and extension. All output is 720p, 24 fps, 3–20 seconds; this is a separate model from Kling V4.

Kling V4 Flash

Endpoints and authentication

  • POST https://apimaster.ai/v1/videos
  • POST https://apimaster.ai/v1/videos/generations
  • GET https://apimaster.ai/v1/videos/{task_id}
  • GET https://apimaster.ai/v1/videos/{task_id}/content
  • GET https://apimaster.ai/v1/video-submissions/by-key

Request fields and limits

Use JSON and Authorization: Bearer YOUR_API_KEY. model must be kling-v4-flash. prompt is required except for a single first-frame image. duration and seconds accept JSON integers 3–20; default 5, null means omitted, explicit 0 fails. If both aliases are supplied, both must be valid and equal. Editing without duration uses the ceiling of the input video-stream duration. resolution is 720p only. aspect_ratio (size is its compatibility alias) accepts 16:9, 9:16, 1:1 and 21:9; only reference mode also accepts auto. Text defaults to 16:9, reference to auto, editing follows the input when omitted. Image-to-video and extension reject nonempty aspect_ratio/size; crop the first frame beforehand. audio may only be true and watermark may only be false.

Parameter JSON type Required Default Meaning and constraints
model string Yes kling-v4-flash Exact public model ID: kling-v4-flash. All five operations use this ID; kling-v4 is a different model.
prompt string By mode — Describe the scene, motion or edit. Required for text, reference, edit and extension; optional only with one first-frame image. Refer to image/video inputs as @Image1, @Video1, etc., numbered from 1 in each media array. The edited source is @Video1.
duration integer / null No 5 Output length in whole JSON seconds, 3–20. Usually defaults to 5. Editing without either duration alias uses ceil(input video-stream duration); extension means NEW segment length. null means omitted; 0, non-integer numbers and numeric strings fail. Output billing uses this integer, even when the file has an extra frame.
seconds integer / null No — Alias of duration, with exactly the same bounds and omission rules. Prefer one alias. When both are present, each must be valid and both must agree; conflicting values return 400.
resolution string No 720p Output quality tier, only 720p. This does not guarantee that the shorter edge is 720 pixels. 1080p and quality selection through mode are unsupported.
aspect_ratio string No By mode Text/reference/edit accept 16:9, 9:16, 1:1, 21:9; only reference also accepts auto. Defaults: text 16:9, reference auto, edit follows its source. Image-to-video and extension reject nonempty values. An empty string is omitted.
size string No — Compatibility alias for aspect_ratio, not a resolution or 1280x720 pixel size. If both aliases are supplied they must match. Remove both for first-frame generation and extension.
image_urls string[] By mode — Public image URL array. Auto mode accepts exactly one first-frame image. For image-only references, set task type reference; reference/edit allow at most 10 images, counting reference_image role entries too. Do not mix this array with first-frame fields in image-to-video; extension accepts no images.
first_frame_image string By mode — Public URL of the single first frame. Alternative to one image_urls item or one first_frame role entry: choose one representation, not several. It selects image-to-video, where prompt is optional. Images must be at least 300×300 px with ratio 2:5–5:2; crop before submission when needed.
image_with_roles {url, role}[] By mode — Array of objects, each requiring url (public HTTP(S) image URL) and role. first_frame selects a single first frame; reference_image is for reference/edit. No last/middle/keyframe roles. Reference images share the 10-image cap across both image fields; references have at most 15 image/video files total.
video_url string By mode — One public source video URL, only with explicit edit or extend. Mutually exclusive with video_urls. Edit requires MP4/MOV, 3–20 video-stream seconds and BOTH dimensions 700–4553 px. Extension follows the source's last frame and returns only the new segment; do not supply a task/interaction ID here.
video_urls string[] By mode — Reference video URLs: at most 5; each MP4/MOV clip must have at least 3 video-stream seconds, each dimension 700–4553 px, combined length at most 20 seconds. Explicit edit/extend may use exactly one item instead of video_url. Excess duration is rejected, not trimmed. Reference mode needs no explicit task selector when this array is used.
omni_reference_task_type string No auto auto: infer text/first-frame/reference from media. reference: treat images as references and require reference media. edit / extend: require exactly one source video. Plain video_url without explicit edit/extend is invalid; two plain images in auto do not imply reference mode.
audio_setting string No auto Only for reference mode WITH videos. auto generates sound; origin preserves the FIRST reference video's sound, or produces no audio track if it has none. Editing generates new sound: omit this field. It is also unsupported for text, image-only references and extension. It does not accept an audio URL.
audio boolean No true Compatibility boolean; omit it or send true. false is rejected. This is not a sound-preservation switch: use audio_setting where supported. Separate audio reference files are unsupported.
watermark boolean No false Compatibility boolean; omit it or send false. true is rejected. This field is not a watermark-removal service for input media.

Use direct public HTTP(S) URLs without embedded credentials; no base64, local paths or task IDs. The supplier does not publish a separate image file-format/byte-size contract here. The gateway's 100 MiB read cap applies to each probed reference/edit video; it is not a universal supplier upload limit.

Modes and media

Operation How to select and required media Defaults and exclusions
Text-to-video No images/videos; prompt required; task type omitted or auto. 5s, 16:9. No reference audio or audio_setting.
First-frame image-to-video Exactly one first frame via ONE of the three image representations; prompt optional. 5s; follows the image. Omit aspect_ratio / size; no last frame.
Reference-to-video reference + images, or reference_image roles, or video_urls; prompt required. 5s, auto; images ≤10, videos ≤5, total ≤15. audio_setting only with videos.
Video editing Explicit edit + exactly one source video; prompt required. Up to 10 optional reference images. Duration follows input, rounded up; ratio follows input. No frame roles or audio_setting.
Video extension Explicit extend + exactly one source video; prompt required. 5 NEW seconds; ratio follows input. No images, aspect override or audio_setting; no edit/reference minimum-size or minimum-duration check.

omni_reference_task_type accepts auto, reference, edit and extend. One image_urls image, first_frame_image or one first_frame role selects image-to-video. Multiple reference images need explicit reference mode or reference_image roles; plain auto with two image_urls images is rejected. video_urls selects reference mode unless edit/extend is explicit. video_url requires explicit edit/extend, and cannot be combined with video_urls. Editing/extension require one video. Editing may use reference images; extension accepts no images or audio_setting and returns only the NEW segment. Public task IDs and native Google/Kling conversation IDs are not continuation inputs here: supply the publicly accessible source video URL.

Use direct public HTTP(S) media URLs without embedded credentials. Reference/edit images: at most 10; image/video references: at most 15 total. Images must be at least 300×300 pixels with width:height between 2:5 and 5:2. Reference videos: at most 5 MP4/MOV files, each at least 3 seconds, total no more than 20 seconds; edit uses one 3–20 second video. Their width AND height must each be 700–4553 pixels. The gateway reads at most 100 MiB per probed video and uses the video track, not movie/audio duration. Extension inputs are exempt from those edit/reference dimension and minimum-duration checks. Media geometry is also validated upstream; rejected submissions have no final generation charge. audio_setting=origin preserves the first reference video's audio (or silence if none); auto generates audio. This field is only supported for reference mode WITH videos. Editing regenerates audio. No audio URLs, last/middle frames, keyframes, negative_prompt, mode, seed, multi_shot, multi_prompt or subject/voice lists.

Output pixels and frame rate

Aspect / operation Documented output pixels Frame rate
16:9 1280×720 24 fps
9:16 720×1280 24 fps
1:1 960×960 24 fps
21:9 1464×628 24 fps
First-frame image-to-video Follows the image ratio; approximately 0.92 MP, e.g. 604×1516 for 2:5. 24 fps

Pixel values describe the output, not valid input dimensions. In particular, 21:9 output is 628 px high and cannot directly meet the 700 px minimum for video reference/edit; prepare compliant source media, or use extension where that minimum does not apply. Output duration may exceed the requested integer by about one frame.

Non-running examples

1. text

{
  "model": "kling-v4-flash",
  "prompt": "A paper boat floats along a quiet stream.",
  "duration": 3,
  "aspect_ratio": "16:9"
}

2. first_frame

{
  "model": "kling-v4-flash",
  "image_urls": [
    "https://example.com/start.png"
  ],
  "duration": 3
}

3. reference_image

{
  "model": "kling-v4-flash",
  "prompt": "Animate the scene from @Image1.",
  "omni_reference_task_type": "reference",
  "image_urls": [
    "https://example.com/style.png"
  ],
  "duration": 3
}

4. mixed_reference

{
  "model": "kling-v4-flash",
  "prompt": "Animate @Image1 with the camera movement from @Video1.",
  "omni_reference_task_type": "reference",
  "image_with_roles": [
    {
      "url": "https://example.com/subject.png",
      "role": "reference_image"
    }
  ],
  "video_urls": [
    "https://example.com/camera.mp4"
  ],
  "duration": 5,
  "aspect_ratio": "auto",
  "audio_setting": "origin"
}

5. reference_video

{
  "model": "kling-v4-flash",
  "prompt": "Follow the camera movement from @Video1.",
  "video_urls": [
    "https://example.com/input.mp4"
  ],
  "duration": 3,
  "aspect_ratio": "auto"
}

6. reference_video / origin

{
  "model": "kling-v4-flash",
  "prompt": "Follow @Video1 and preserve its original sound.",
  "video_urls": [
    "https://example.com/input.mp4"
  ],
  "audio_setting": "origin",
  "duration": 3
}

7. edit / duration

{
  "model": "kling-v4-flash",
  "prompt": "Change the light in @Video1 to sunset.",
  "omni_reference_task_type": "edit",
  "video_url": "https://example.com/input.mp4",
  "duration": 3
}

8. edit / default

{
  "model": "kling-v4-flash",
  "prompt": "Change @Video1 to a snowy scene.",
  "omni_reference_task_type": "edit",
  "video_url": "https://example.com/input.mp4",
  "image_with_roles": [
    {
      "url": "https://example.com/style.png",
      "role": "reference_image"
    }
  ]
}

9. extend

{
  "model": "kling-v4-flash",
  "prompt": "Continue the camera moving forward.",
  "omni_reference_task_type": "extend",
  "video_url": "https://example.com/input.mp4",
  "duration": 3
}

Billing

Official nominal base prices are USD 0.094 per output second (720P) and USD 0.0628 per BILLABLE second (720P-input). Text, image, image-only reference and extension use output/new-segment seconds. Video reference and editing use output + max(input, output); sum all video-track input durations FIRST, then round that sum up to whole seconds. Example: 3-second output from a 3.04-second source bills 3 + max(4,3) = 7 seconds at the input tariff, not three seconds. Two 3.04-second references total 6.08, round to 7, then add the greater of 7 and output. The requested integer output duration is billed even if the file contains approximately one extra frame. Resource-pack discounts are separate from this nominal base; your actual sale price also depends on the account/model policy shown on the model card. The receipt/log amount is authoritative. Failed generation refunds the reservation; stopping polling does not cancel a task. An ambiguous network timeout is not confirmed rejection and does not justify a replacement generation.

input_seconds = ceil(sum(input_video_stream_seconds))
billable_seconds = output_seconds + max(input_seconds, output_seconds)

Polling, errors and safe retry

The first successful submission returns HTTP 200 with a PUBLIC task_id and queued. Poll GET /v1/videos/{task_id} until queued/in_progress becomes completed or failed; tolerate temporary unknown. Completed url and metadata.url are authenticated proxies: use the same Bearer key, or GET /v1/videos/{task_id}/content. Failed tasks expose error.code=generation_failed and a sanitized message; validation errors use HTTP 400. Use Idempotency-Key (8–128 visible ASCII characters, no spaces) for each intended operation. Same-account/key/unchanged-request replays return HTTP 202 without a second generation or reservation; changing the request returns 409. GET /v1/video-submissions/by-key with the original header reads the gateway receipt. accepted with task_ready=true provides a pollable task_id; pending/submitting or accepted without a ready task means wait; acceptance_unknown means preserve the key and contact support, without automatic resubmission. A missing/404 receipt does not prove non-acceptance. This is gateway idempotency, not supplier-side discovery. Keys are retained at least 30 days. Final customer charges are in consumption logs matched by other.task_id; task polling does not promise a final invoice. /v1/videos/quote is not supported for this model. Examples are inert JSON: replace example.com resources and use a new key for each NEW operation, keeping the same body/key only for a retry.

{
  "id": "task_REDACTED_EXAMPLE",
  "task_id": "task_REDACTED_EXAMPLE",
  "object": "video",
  "model": "kling-v4-flash",
  "status": "queued",
  "created_at": 1794052800
}
{
  "id": "task_REDACTED_EXAMPLE",
  "task_id": "task_REDACTED_EXAMPLE",
  "object": "video",
  "model": "kling-v4-flash",
  "status": "completed",
  "progress": 100,
  "created_at": 1794052800,
  "url": "https://apimaster.ai/v1/videos/task_REDACTED_EXAMPLE/content",
  "metadata": {
    "url": "https://apimaster.ai/v1/videos/task_REDACTED_EXAMPLE/content"
  }
}
{
  "id": "task_REDACTED_EXAMPLE",
  "task_id": "task_REDACTED_EXAMPLE",
  "object": "video",
  "model": "kling-v4-flash",
  "status": "failed",
  "progress": 100,
  "created_at": 1794052800,
  "error": {
    "code": "generation_failed",
    "message": "Generation failed"
  }
}

APIMart · Kling V4 Flash · Kling AI