promptstringrequired
Describe subject, action, camera and light.
kwaivgi/kling-video/v4/text-to-videoKling V4 Text to Video by Kuaishou turns a text prompt into a 3-30 second video at 720p or 1080p.
Try the model
Customize your input with more control.
What would you like to do next?
Select an example to load its inputs and result into the playground.
{
"aspect_ratio": "16:9",
"prompt": "Close-up: a single drop of water falls from the tip of a leaf into a shallow dish, creating concentric ripples. Warm window light gives the ripples a golden glow. Macro cinematography, photorealistic."
}{
"aspect_ratio": "16:9",
"prompt": "A detective in a black trench coat stands on a rooftop in the rain, looking through a telescope at the neon street below. Slow push-in, cinematic lighting."
}Kling V4 text-to-video: write a scene and get back a 3–30 second clip at 720p or 1080p.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 2,500 characters. |
aspect_ratio | 16:9 / 9:16 / 1:1 / 21:9 | 16:9 | Output frame shape. |
resolution | 720p / 1080p | 1080p | Output resolution. |
duration | 3–30 | 5 | Output length in seconds. |
Billed per output second: $0.157 at 720p, $0.235 at 1080p.
| Output | Price |
|---|---|
| 5s, 1080p (default) | $1.175 |
| 5s, 720p | $0.785 |
| 10s, 1080p | $2.35 |
| 30s, 1080p | $7.05 |
| Failed runs are not charged. |
Other Kling V4 endpoints: kwaivgi/kling-video/v4/text-to-video, kwaivgi/kling-video/v4/image-to-video, kwaivgi/kling-video/v4/reference-to-video, kwaivgi/kling-video/v4/video-edit.
Start building
Submit this model through the SandBase Unified Run API.
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "kwaivgi/kling-video/v4/text-to-video",
"prompt": "A detective in a black trench coat stands on a rooftop in the rain, looking through a telescope at the street below.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9"
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"Create a SandBase API key and set it in your server environment. All requests use Bearer authentication.
export SANDBASE_API_KEY="YOUR_API_KEY"Keep the key on your server. Do not expose it in browser code or commit it to a repository.
POST to /v1/run with this model ID and its inputs. The request example above includes submission and polling.
Use the returned run ID to poll until the status is completed, failed or timeout. Read output only after completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Pass a publicly accessible file URL in the model’s image, video or audio field. Supported formats and limits are shown beside each Playground input.
Use the upload or replace control on supported image fields in the Playground. Video URL fields accept a hosted driving video; they do not imply video-upload support.
promptstringrequiredDescribe subject, action, camera and light.
durationintegerOutput length in seconds (3-30).
Default: 5
Minimum: 3
Maximum: 30
resolutionstringOutput resolution.
Default: "1080p"
Possible values: "720p", "1080p"
aspect_ratiostringOutput frame shape.
Default: "16:9"
Possible values: "16:9", "9:16", "1:1", "21:9"
{
"model": "kwaivgi/kling-video/v4/text-to-video",
"prompt": "A detective in a black trench coat stands on a rooftop in the rain, looking through a telescope at the street below.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9"
}A completed run exposes its result in output. The following is the model’s saved example, not a new generation.
[
{
"url": "https://static.sandbase.ai/examples/d9d2539c-75cd-4ee7-b7a7-ee70aa5d0db0/output/54ab6613-48ea-4b20-8c2d-c299edea2f12.mp4"
}
]