promptstringrequired
Describe the image. Refer to reference images as @Image1, @Image2, ...
kwaivgi/kling-image/v4Kling Image V4 by Kuaishou generates photorealistic images with accurate text rendering from a text prompt at native 2K, 4K or 8K resolution.
Try the model
Select an example to load its inputs and result into the playground.
{
"aspect_ratio": "16:9",
"prompt": "Event poster for a jazz night: a saxophonist silhouetted against a deep blue stage light, large title \"MIDNIGHT JAZZ\" in bold Art Deco letters, smaller line \"Friday 22 November · Blue Room · 9 PM\" at the bottom, grainy film texture."
}{
"aspect_ratio": "16:9",
"prompt": "Camera-like photograph of an elderly fisherman mending a net on a wooden pier at golden hour, weathered skin and knitted sweater in fine detail, shallow depth of field, 85mm lens."
}Kling Image V4 generates photorealistic images from a text prompt at native 2K, 4K or 8K, with sharp in-image text (up to about 2,000 characters, multilingual) and dense layouts.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Put any text to render in quotation marks. |
aspect_ratio | auto / 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 3:2 / 2:3 / 21:9 | auto | auto picks a shape from the prompt and references. |
resolution | 2K / 4K / 8K | 2K | Native output resolution. |
num_images | 1–9 | 1 | Independent images, each billed. |
Billed per output image by resolution.
| Resolution | Per image |
|---|---|
| 2K (default) | $0.063 |
| 4K | $0.0945 |
| 8K | $0.1575 |
| Failed runs are not charged. |
Other Kling Image V4 endpoints: kwaivgi/kling-image/v4, kwaivgi/kling-image/v4/edit, kwaivgi/kling-image/v4/long-image.
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-image/v4",
"prompt": "A faceted glass perfume bottle on wet black slate, soft rim light, a small card beside it printed with \"NOCTURNE\" in thin serif letters, macro product photography.",
"num_images": 1,
"resolution": "2K",
"aspect_ratio": "auto"
}
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 the image. Refer to reference images as @Image1, @Image2, ...
num_imagesintegerNumber of independent images to generate (1-9).
Default: 1
Minimum: 1
Maximum: 9
resolutionstringOutput resolution. 8K is native ultra-high resolution.
Default: "2K"
Possible values: "2K", "4K", "8K"
aspect_ratiostringOutput frame shape. auto picks one from the prompt and references.
Default: "auto"
Possible values: "auto", "16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"
{
"model": "kwaivgi/kling-image/v4",
"prompt": "A faceted glass perfume bottle on wet black slate, soft rim light, a small card beside it printed with \"NOCTURNE\" in thin serif letters, macro product photography.",
"num_images": 1,
"resolution": "2K",
"aspect_ratio": "auto"
}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/bcc829ad-1640-449e-9efa-04cf84da1d97/output/04854f77-94c7-469a-908e-4f743ba7ea16.png"
}
]