Kling V4 Flash — Complete Video, Element and Voice API Guide
Kling V4 Flash text-to-video, image-to-video and Omni generation, complete parameters, resource management, limits, examples and billing.
Kling V4 Flash
Use kling-v4-flash to create asynchronous videos through APIMaster. This guide covers the native workflow and its complete request fields. Create an API key in the console. The API base is https://apimaster.ai/v1.
Capabilities and model differences
| Capability | kling-v4 |
kling-v4-flash |
|---|---|---|
| Text to video | Yes | Yes |
| Image to video | First, middle and last frames; up to 10 images | One first frame |
| Omni image references | First/middle/last frames and reference images | First frame and reference images |
| Feature video references and editing a base video | Yes | Yes |
| Custom and preset elements | Yes | Yes |
| Voice references and voice management | Yes | Unsupported |
| Output resolution | 720p, 1080p; default 1080p | 720p only |
| Output duration | 3–30 integer seconds | 3–20 integer seconds |
| Video reference duration | Each and combined input: 3–30 seconds | Each and combined input: 3–20 seconds |
| Output frame rate | 24 fps | 24 fps |
The native workflow uses settings and, for image or Omni requests, contents. Existing flat convenience requests to /videos/generations retain their existing documented contract. Do not mix the two parameter formats or assume their defaults are identical.
Authentication and endpoints
Send Authorization: Bearer YOUR_APIMASTER_KEY and Content-Type: application/json. Use an Idempotency-Key header to recover a submission after a timeout without creating another paid task.
| Method | Path below https://apimaster.ai/v1 |
Purpose |
|---|---|---|
| POST | /kling/kling-v4-flash/text-to-video |
Generate from text |
| POST | /kling/kling-v4-flash/image-to-video |
Generate from keyframe images |
| POST | /kling/kling-v4-flash/omni-video |
Combine references or edit a base video |
| GET | /videos/{task_id} |
Query an owned video or resource task |
| GET | /videos/{task_id}/content |
Download a completed video; requires authentication |
| POST | /kling/kling-v4-flash/create-element |
Create an image or video character element |
| GET | /kling/kling-v4-flash/elements |
List your element creation tasks |
| GET | /kling/kling-v4-flash/elements/{resource_id} |
Query your element |
| GET | /kling/kling-v4-flash/elements/presets |
List preset elements |
| DELETE | /kling/kling-v4-flash/elements/{resource_id} |
Delete your completed custom element |
A resource ID returned by APIMaster is an owned task_… handle; use that handle when referencing or deleting the resource. Preset IDs carry a preset: prefix. Private resources from another account cannot be queried, listed, deleted or referenced. Resources remain bound to their creation route; unavailable routes return an error instead of silently substituting a different resource.
Generation request parameters
| Field | Type | Required | Description |
|---|---|---|---|
model |
string | No on native route | If provided, must equal kling-v4-flash from the URL |
prompt |
string | Text-to-video | Positive and negative scene descriptions; use this only for text-to-video |
contents |
object[] | Image-to-video / Omni | Ordered input list; must contain exactly one prompt item |
settings |
object | No | Output controls; individual fields are described below |
options |
object | No | Callback, external reference and watermark controls |
notifications |
object | No | APIMaster's verified task webhook configuration; see webhooks |
client_reference_id |
string | No | Optional reference for APIMaster task notifications; up to 128 bytes |
A prompt supports up to 26,000 English characters or 11,000 non-English characters. Mixed text must satisfy English / 26000 + non-English / 11000 <= 1. Include reference IDs as @id in your prompt and explain which appearance, motion, background or audio to preserve. Describe multi-scene sequences in chronological order.
contents[] fields
| Field | Type | Required | Description |
|---|---|---|---|
type |
string | Yes | One of the content types below |
text |
string | For prompt |
Prompt content |
url |
string | For image/video types | Publicly reachable media URL; image types also accept Base64 |
id |
string | Conditional | Unique task-local reference ID for @id; required for elements and voices, and when V4 uses multiple middle frames or reference images |
element_id |
string | For element |
Your APIMaster element resource handle or a returned preset: ID |
voice_id |
string | For voice |
Your APIMaster voice handle, a bound element voice handle, or a returned preset: ID; V4 only |
| Content type | Meaning | Image-to-video | Omni |
|---|---|---|---|
prompt |
Instructions for the output | Required | Required |
first_frame |
Fix the initial frame | Both models | Both models |
middle_frame |
Intermediate keyframes in chronological order | V4 only | V4 only |
last_frame |
Fix the final frame | V4 only | V4 only |
refer_image |
Appearance, object, scene or style reference; does not lock a frame | Unsupported | Both models |
feature_video |
Reference motion, camera movement or pacing | Unsupported | Both models |
base_video |
The video to edit | Unsupported | Both models; at most one |
element |
Persistent character, object or scene element | Unsupported | Both models |
voice |
Voice identity reference | Unsupported | V4 only |
Keep the first-frame image before all other images and the last-frame image after all other images. Order middle frames as they should occur. Referencing a media ID in text alone does not upload the media.
settings fields
| Field | Type | Required | Values and defaults |
|---|---|---|---|
resolution |
string | No | 720p only; default 720p |
duration |
integer | No | 3–20 seconds. An explicit value takes precedence over a duration in the prompt |
aspect_ratio |
string | No; text/Omni only | 21:9, 16:9, 9:16, 1:1, 4:3, 3:4; Omni also accepts adaptive. Text default: 16:9; Omni default: adaptive. Image-to-video follows its image inputs |
audio |
string | No; Omni only | native (default) or original. native generates matching audio; original preserves audio from base_video, or from the first feature_video if no base video is supplied |
original audio requires a base or feature video and cannot be combined with voice references. These native APIs do not offer a silent audio=false switch.
When duration is omitted, a duration explicitly identified in the prompt is used. If neither specifies a duration, an Omni request with base_video uses its duration rounded to the nearest whole second; otherwise the default is 10 seconds. The final billed output duration is taken from the completed task's usage, rather than guessed from the downloaded container.
For Omni adaptive aspect ratio: an explicit ratio in the prompt comes first. Otherwise the order is base video, keyframes (first frame preferred), then a single feature video. Multiple feature videos fall back to 16:9; with no applicable reference the default is 16:9. An explicit non-adaptive aspect_ratio overrides a ratio mentioned in the prompt.
options fields
| Field | Type | Required | Description |
|---|---|---|---|
callback_url |
string | No | Native task-state callback URL. For verified APIMaster callbacks with public IDs and delivery records, use notifications instead |
external_task_id |
string | No | Client reference. Use the returned task ID for status queries and Idempotency-Key for safe retries |
watermark_info |
object | No | Optional parallel watermarked result configuration |
watermark_info.enabled |
boolean | No | false by default. Explicit false is preserved; true requests a watermarked result as well. Custom watermark artwork is unsupported |
Media and reference limits
| Input | Limits |
|---|---|
| Generation images | JPG/JPEG/PNG, at most 30 MB each, width and height at least 300 px, width:height between 2:5 and 5:2; at most 10 images |
| Input videos | MP4/MOV, at most 300 MB each, each dimension 700–4553 px, total pixel area at most 8,294,400; 24–60 fps; aspect ratio 2:5–5:2 |
| V4 video duration | Each video and combined normalized video input: 3–30 seconds |
| Flash video duration | Each video and combined normalized video input: 3–20 seconds |
| Video count | Up to 5 feature/base videos and video character elements combined; at most 1 base video |
| Element count | Up to 7 elements, including at most 3 video character elements |
| Voice count | Up to 3 voices; V4 only |
| Total materials | At most 15 images, videos, elements and voices combined; prompt items are excluded |
A video character element contributes its video duration and occupies a video-reference slot. Image elements have their own creation limits, described below. Media files must remain accessible while the task runs; signed URLs must not expire before ingestion.
Examples
Text-to-video
curl "https://apimaster.ai/v1/kling/kling-v4-flash/text-to-video" \
-H "Authorization: Bearer $APIMASTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: YOUR_UNIQUE_REQUEST_ID" \
-d '{"prompt":"A paper boat floats on a quiet pond, static camera, gentle water sounds.","settings":{"duration":3,"resolution":"720p","aspect_ratio":"16:9"},"options":{"watermark_info":{"enabled":false}}}'
Image-to-video
{
"contents": [
{"type":"prompt","text":"Start at @first. Slowly move the camera toward the subject."},
{"type":"first_frame","url":"https://YOUR_PUBLIC_HOST/first.jpg","id":"first"}
],
"settings": {"duration":5,"resolution":"720p"}
}
Send this body to POST https://apimaster.ai/v1/kling/kling-v4-flash/image-to-video. V4 can append middle and last frames; Flash accepts only one first frame.
Omni references and editing
{
"contents": [
{"type":"prompt","text":"Edit @source: replace the main object with @object, preserve camera movement and background."},
{"type":"base_video","url":"https://YOUR_PUBLIC_HOST/source.mp4","id":"source"},
{"type":"refer_image","url":"https://YOUR_PUBLIC_HOST/object.png","id":"object"}
],
"settings": {"duration":5,"resolution":"720p","aspect_ratio":"adaptive","audio":"original"}
}
Send this to POST https://apimaster.ai/v1/kling/kling-v4-flash/omni-video. For motion reference without editing an existing shot, replace base_video with feature_video and describe the intended motion in the prompt. For an element reference, use {"type":"element","element_id":"task_YOUR_ELEMENT","id":"character"} and mention @character in the prompt.
Element management
Use POST https://apimaster.ai/v1/kling/kling-v4-flash/create-element. Element creation is asynchronous. Query the returned task until it completes, then use the returned resource.element_id in an Omni request. Preset elements are available from the presets endpoint and do not require creation.
| Field | Type | Required | Description |
|---|---|---|---|
element_name |
string | Yes | 1–20 characters |
element_description |
string | Yes | 1–100 characters |
reference_type |
string | Yes | image_refer or video_refer |
element_image_list |
object | For image_refer |
Front image and 1–3 other images |
element_image_list.frontal_image |
string | For image element | Front-view public URL or Base64 |
element_image_list.refer_images |
object[] | For image element | 1–3 reference views that differ from the front |
element_image_list.refer_images[].image_url |
string | Yes in each view | Public image URL or Base64 |
element_video_list |
object | For video_refer |
Video character source; do not combine with image source fields |
element_video_list.refer_videos |
object[] | For video element | Exactly one video |
element_video_list.refer_videos[].video_url |
string | Yes in the video | Publicly reachable MP4/MOV |
element_voice_id |
string | No | Bind an existing owned/preset voice. Image voice binding requires a character or humanoid element |
tag_list |
object[] | No | Element classification tags |
tag_list[].tag_id |
string | Yes in each tag | o_101 hottest, o_102 character, o_103 animal, o_104 item, o_105 costume, o_106 scene, o_107 effect, o_108 other |
callback_url |
string | No | Native task callback |
external_task_id |
string | No | Client reference; use APIMaster task ID for polling |
Element image files support JPG/JPEG/PNG, at most 10 MB, dimensions at least 300 px, and aspect ratio 1:2.5–2.5:1. Video character sources must be realistic humanoid subjects: 3–8 seconds, 1080p, 16:9 or 9:16, MP4/MOV, at most 200 MB. A source video containing speech can create and bind a voice automatically. A returned bound voice is referenced through its APIMaster handle ending in .voice.
{
"element_name":"Blue mascot",
"element_description":"A blue fictional mascot seen from multiple angles",
"reference_type":"image_refer",
"element_image_list":{
"frontal_image":"https://YOUR_PUBLIC_HOST/front.png",
"refer_images":[{"image_url":"https://YOUR_PUBLIC_HOST/side.png"}]
},
"tag_list":[{"tag_id":"o_104"}]
}
Use GET …/elements?pageNum=1&pageSize=30 for your element tasks; pageNum 1–1000, pageSize 1–500. Use GET …/elements/presets for the preset library. Delete a completed custom element using DELETE …/elements/task_YOUR_ELEMENT; preset elements cannot be deleted. Deletion does not delete historical videos or consumption records.
Voices
This model does not support voice inputs or voice management.
Task lifecycle, downloads and errors
Submission returns immediately after acceptance with an APIMaster task ID:
{"id":"task_EXAMPLE","task_id":"task_EXAMPLE","object":"video","model":"kling-v4-flash","status":"queued"}
Poll GET https://apimaster.ai/v1/videos/task_EXAMPLE with the same account's API key. States are queued, in_progress, completed and failed. Completed videos return an authenticated url under /videos/task_EXAMPLE/content. Resource tasks instead return an element/voice object with an owned resource handle. Resource lists include pending and failed creation tasks as well as completed ones.
curl "https://apimaster.ai/v1/videos/task_EXAMPLE" -H "Authorization: Bearer $APIMASTER_API_KEY"
curl -L "https://apimaster.ai/v1/videos/task_EXAMPLE/content" \
-H "Authorization: Bearer $APIMASTER_API_KEY" -o output.mp4
Poll every 3–5 seconds with backoff. Do not create a replacement task just because generation is still running. After a submission timeout, recover using the same Idempotency-Key; changing the body while reusing a key is rejected. Download and store completed media promptly: remote result links are temporary and generated results have a limited retention period.
| Situation | Handling |
|---|---|
| Unsupported parameter, conflicting model or invalid field type | HTTP 400; fix the request before retrying |
| Invalid API key or unavailable model permissions | Check credentials and account model access |
| Missing/wrong-owner resource | Rejected; never substitute another user's resource |
| Missing public media or expired source URL | Correct accessibility and submit a new request when appropriate |
| Rate limit or concurrency limit | Back off; poll accepted tasks rather than resubmitting |
| Accepted task fails | Task becomes failed; the normal task refund path applies |
| Video completed before usage/receipt is ready | Keep polling; final billing waits for authoritative usage |
Billing
Always check the live model card for your current price. Video generation is billed by duration and resolution. Image references, image elements and voices do not automatically count as input video; video character elements do.
without input video:
billable_seconds = output_duration
with input video:
billable_seconds = output_duration + max(input_duration, output_duration)
Input-video tasks use a separate per-second tariff. The input duration is the normalized combined duration of feature videos, base video and video character elements. A short input video can therefore be billed for twice the output duration; do not estimate the charge from output length alone.
The gateway reserves a bounded amount before submission and settles against completed task usage. An omitted duration can be resolved from the prompt by the model, so the reservation can exceed the eventual charge; the excess is returned after completion. Resource creation is a separate operation: element creation and custom voice creation must not be priced as video seconds. Custom voice creation has its own per-call charge; the video-generation discount does not establish a voice-creation discount.
Check the console consumption log for the actual charged amount and generated video preview. Account groups and discounts can affect your final price. A successful HTTP response or a playable video establishes functional delivery, not independent model fingerprint verification.
When a watermarked result was requested, use GET /v1/videos/{task_id}/content?watermark=true to download that version. The normal content endpoint returns the original version. Both require authentication.
Existing convenience endpoint
APIMaster gateway contract for kling-v4-flash, checked 2026-11-07. APIMaster 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.
Endpoints and authentication
POST https://apimaster.ai/v1/videosPOST https://apimaster.ai/v1/videos/generationsGET https://apimaster.ai/v1/videos/{task_id}GET https://apimaster.ai/v1/videos/{task_id}/contentGET 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"
}
}
