promptstringwajib
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.
Coba model ini
Pilih contoh untuk memuat input dan hasilnya ke 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.094 |
| 8K | $0.157 |
| 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.
Mulai membangun
Kirim model ini melalui 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"Buat SandBase API key dan atur di environment server Anda. Semua permintaan menggunakan autentikasi Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Simpan key di server. Jangan tampilkan di kode browser atau commit ke repository.
POST ke /v1/run dengan ID model ini dan inputnya. Contoh permintaan di atas mencakup pengiriman dan polling.
Gunakan run ID yang dikembalikan untuk polling sampai status completed, failed, atau timeout. Baca output hanya setelah completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Kirim URL file yang dapat diakses publik di field image, video, atau audio model. Format dan batas yang didukung ditampilkan di samping setiap input Playground.
Gunakan kontrol upload atau replace pada field gambar yang didukung di Playground. Field URL video menerima video driving yang di-host; ini tidak berarti dukungan upload video.
promptstringwajibDescribe the image. Refer to reference images as @Image1, @Image2, ...
num_imagesintegerNumber of independent images to generate (1-9).
Default: 1
Minimum: 1
Maksimum: 9
resolutionstringOutput resolution. 8K is native ultra-high resolution.
Default: "2K"
Nilai yang mungkin: "2K", "4K", "8K"
aspect_ratiostringOutput frame shape. auto picks one from the prompt and references.
Default: "auto"
Nilai yang mungkin: "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"
}Run yang selesai menampilkan hasilnya di output. Berikut adalah contoh tersimpan model ini, bukan generasi baru.
[
{
"url": "https://static.sandbase.ai/examples/bcc829ad-1640-449e-9efa-04cf84da1d97/output/04854f77-94c7-469a-908e-4f743ba7ea16.png"
}
]