Wildlife documentary tracking shot at blue hour in a snowy Hokkaido pine clearing: a wild red fox trots smoothly across deep untouched powder snow, leaving crisp paw prints, warm breath misting in the freezing air. Midway it pauses, ears pivoting sharply as a clump of snow slips off a dark cedar bough behind it. Natural twilight, steady lateral tracking camera, no cuts. Audio: soft crunching snow footsteps, gentle winter wind through pine needles. No text, no logos, no watermarks.
Kling 4.0 Flash API
kwaivgi/kling-v4.0-flash/text-to-videoKling 4.0 Flash Text to Video turns a text prompt into a 3–20 second 720p clip across five aspect ratios at 18.8 credits per second. With the Kling 4.0 Flash API, scene continuity, camera direction, and audio cues stay consistent at lower unit cost.
Examples
REST API
Quick Start
Submit a Kling 4.0 Flash Text to Video request in three steps, capture task_id, and fetch the generated 720p video.
Connect to the Vidgo API
Create an API key on your server and send it in the Authorization header as a Bearer token.
- Endpoint
- POST
https://api.vidgo.ai/api/generate/submit - Authentication
- Authorization: Bearer VIDGO_API_KEY
Submit one video task
Send the model ID and mode inputs to the unified submit endpoint.
curl --request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "kwaivgi/kling-v4.0-flash/text-to-video",
"input": {
"prompt": "Wildlife documentary tracking shot at blue hour in a snowy Hokkaido pine clearing: a wild red fox trots smoothly across deep untouched powder snow, leaving crisp paw prints, warm breath misting in the freezing air. Midway it pauses, ears pivoting sharply as a clump of snow slips off a dark cedar bough behind it. Natural twilight, steady lateral tracking camera, no cuts. Audio: soft crunching snow footsteps, gentle winter wind through pine needles. No text, no logos, no watermarks.",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}'Wait for the result
Poll the status endpoint with task_id until it reaches finished or failed.
Track status
GET https://api.vidgo.ai/api/generate/status/{task_id}Poll while not_started or running; read data.files[].file_url when finished.
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "WEGGOG5CV8XNKEN5",
"status": "not_started",
"created_time": "2026-11-25T11:13:02"
}
}{
"code": 200,
"data": {
"task_id": "WEGGOG5CV8XNKEN5",
"status": "finished",
"files": [
{
"file_type": "video",
"file_url": "https://cdn.vidgo.ai/apis/models/kwaivgi/kling-v4.0-flash/text-to-video/v1/01/output.mp4"
}
],
"created_time": "2026-11-25T11:13:02",
"error_message": null,
"progress": 100
}
}Complete runnable example
End-to-end script combining submission, polling, terminal checks, and output extraction.
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "kwaivgi/kling-v4.0-flash/text-to-video",
"input": {
"prompt": "Wildlife documentary tracking shot at blue hour in a snowy Hokkaido pine clearing: a wild red fox trots smoothly across deep untouched powder snow, leaving crisp paw prints, warm breath misting in the freezing air. Midway it pauses, ears pivoting sharply as a clump of snow slips off a dark cedar bough behind it. Natural twilight, steady lateral tracking camera, no cuts. Audio: soft crunching snow footsteps, gentle winter wind through pine needles. No text, no logos, no watermarks.",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
while true; do
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep 2
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
doneRequest Parameters
Place model and optional callback_url at the request root, and mode parameters inside input.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | — | Fixed to kwaivgi/kling-v4.0-flash/text-to-video. |
| callback_url | string (URL) | No | — | Public HTTP(S) URL that receives the terminal task payload. |
| input.prompt | string | Yes | — | Text description of action, camera work, lighting, and audio cues (1–26,000 characters). |
| input.duration | integer | No | 5 | Whole seconds from 3 to 20. |
| input.resolution | string | No | 720p | Fixed to 720p. |
| input.aspect_ratio | string | No | 16:9 | Output framing: auto, 16:9, 9:16, 1:1, or 21:9. |
Response Fields
Submission returns task_id immediately. Status responses provide generated video files or error details upon completion.
| Field | Type | Description |
|---|---|---|
| code | integer | Application result code; 0 or 200 indicates success. |
| data.task_id | string | Unique task identifier for status polling. |
| data.status | string | not_started | running | finished | failed |
| data.progress | number | Completion percentage (0–100). |
| data.files[].file_url | string | Public URL of the generated video. |
| data.files[].file_type | string | File type, video for video outputs. |
| data.error_message | string | null | Failure detail when status is failed. |
Task Lifecycle
Poll only while status is not_started or running; stop on finished or failed.
not_startedAccepted and queued to start.
runningVideo generation is running; keep polling.
finishedComplete; read video URL from data.files[].file_url.
failedFailed; read data.error_message and stop polling.
Polling and Errors
- Authentication401 means the Bearer API key is missing or invalid.
- Validation400 means a parameter, duration (3–20 s), or total input video duration (≤20 s) is invalid.
- Polling intervalPoll every 5–10 seconds, or set callback_url to avoid polling.
Model Specifications
| Specification | Value | Description |
|---|---|---|
| Model | kwaivgi/kling-v4.0-flash/text-to-video | Public model identifier for asynchronous video generation. |
| Resolution | 720p | Fixed 720p output. |
| Duration | 3–20 s | Defaults to 5 s in generation modes; total input video duration up to 20 s. |
| Aspect ratio | auto | 16:9 | 9:16 | 1:1 | 21:9 | Defaults to 16:9. |
| Pricing | 18.8 / 12.6 credits/s | 18.8 credits/s ($0.094/s) without video input; 12.6 credits/s ($0.063/s) with video input, billed on output + max(output, ceil(total input seconds)). |
Related Models
Kling 4.0 Flash API FAQ
What is the Kling 4.0 Flash API?
Kling 4.0 Flash Text to Video is a Kuaishou video generation model designed for fast, cost-efficient 720p production. The Kling 4.0 Flash API turns text prompts into 3–20 second videos across five aspect ratios at 18.8 credits per second. Single-pass generation keeps motion, framing, and scene details consistent while lowering unit cost compared with the full Kling 4.0 tier. You can call it programmatically or try it from the playground above.
How long can a Kling 4.0 Flash API clip be?
Any integer duration from 3 to 20 seconds in a single pass, defaulting to 5 seconds.
What resolution does the Kling 4.0 Flash API output?
It outputs exclusively at 720p. For 1080p output or clips up to 30 seconds, use Kling 4.0 Text to Video.
Which aspect ratios work in Kling 4.0 Flash Text to Video?
You can select auto, 16:9, 9:16, 1:1, or 21:9, with 16:9 as the default.
How much does the Kling 4.0 Flash API cost per second?
It costs 18.8 credits ($0.094) per output second. A 5-second clip is 94 credits ($0.47) and a 20-second clip is 376 credits ($1.88).
How long can the prompt be in Kling 4.0 Flash Text to Video?
Prompts accept 1 to 26,000 characters after trimming, giving enough room for detailed scene beats, camera movement, and sound cues.
How does Kling 4.0 Flash differ from Kling 4.0 Text to Video?
Kling 4.0 Flash focuses on 720p single-prompt clips up to 20 seconds at 18.8 credits/s, whereas Kling 4.0 adds 1080p, 30-second duration, and multi_prompt shot lists at 28.5–42.5 credits/s.



