imagestring
Optional first frame. Min 300x300 px, aspect ratio 0.4-2.5, up to 30 MB.
kwaivgi/kling-video/v4Kling V4 by KwaiVGI in one endpoint: generate 3-30 second videos with native audio from text, start and end frames, reference images and reference videos, at 720p, 1080p or 4K.
ลองใช้โมเดล
PNG, JPEG, WebP หรือ GIF · สูงสุด 20 MiB
PNG, JPEG, WebP หรือ GIF · สูงสุด 20 MiB
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
เอาต์พุตของคุณจะแสดงที่นี่
กรอกอินพุตให้ครบ แล้วคลิก Run
Kling V4 in a single endpoint: text-to-video, start/end-frame image-to-video, and reference-to-video, 3–30 seconds with native audio.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Refer to references as @Image1, @Video1, … |
image | image URL | — | Optional first frame. |
end_image | image URL | — | Optional last frame. |
images | image URL[] | — | Up to 10 reference images. |
videos | video URL[] | — | Up to 5 reference videos, 3–30s each, 30s combined. |
voice_ids | string[] | — | Up to 2 custom voice IDs from Kling Create Voice. Not combinable with videos. |
aspect_ratio | 21:9 / 16:9 / 9:16 / 1:1 | — | Leave empty to follow the inputs. |
resolution | 720p / 1080p / 4k | 1080p | Output resolution. |
dynamic_range | sdr / hdr | sdr | hdr outputs 10-bit HDR video. 1080p and 4k only. |
duration | 3–30 | 5 | Output length in seconds. |
Without reference videos: $0.157 per output second at 720p, $0.235 at 1080p, $0.549 at 4K. With reference videos: $0.094 (720p), $0.141 (1080p) or $0.329 (4K) per second of output plus input, where the input side counts at least as long as the output. The quote before submission assumes 30 seconds of reference video when the length cannot be read.
HDR adds $0.047 per output second at 1080p and $0.078 at 4K.
| Request | Price |
|---|---|
| 5s, 1080p, text or images (default) | $1.175 |
| 5s, 720p, text or images | $0.785 |
| 5s, 4K, text or images | $2.745 |
| 5s, 4K, text or images, HDR | $3.135 |
| 5s, 1080p, 8s reference video | $1.833 |
Failed runs are not charged.
Task-specific 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. Faster and cheaper: kwaivgi/kling-video/v4/flash/text-to-video.
เริ่มสร้าง
ส่งโมเดลนี้ผ่าน 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",
"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",
"dynamic_range": "sdr"
}
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"สร้าง SandBase API key และตั้งค่าไว้ในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอทั้งหมดใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์หรือคอมมิตลง repository
POST ไปที่ /v1/run ด้วย model ID นี้และอินพุตของมัน ตัวอย่างคำขอด้านบนมีทั้งการส่งและการ polling
ใช้ run ID ที่ส่งกลับมาเพื่อ polling จนกว่าสถานะจะเป็น completed, failed หรือ timeout ให้อ่าน output หลังจาก completed เท่านั้น
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"ส่ง URL ไฟล์ที่เข้าถึงได้สาธารณะในช่อง image, video หรือ audio ของโมเดล รูปแบบและข้อจำกัดที่รองรับแสดงอยู่ข้างแต่ละอินพุตใน Playground
ใช้ตัวควบคุม upload หรือ replace ในช่องรูปภาพที่รองรับใน Playground ช่อง URL ของวิดีโอรองรับวิดีโอ driving ที่โฮสต์ไว้; ไม่ได้หมายความว่าสามารถอัปโหลดวิดีโอได้
imagestringOptional first frame. Min 300x300 px, aspect ratio 0.4-2.5, up to 30 MB.
imagesarrayUp to 10 reference images, referenced as @Image1, @Image2, ...
promptstringจำเป็นText prompt. Refer to reference inputs as @Image1, @Video1, ...
videosarrayUp to 5 reference videos (3-30s each, 30s combined), referenced as @Video1, ... Video references switch to the input-plus-output price.
durationintegerOutput length in seconds (3-30).
ค่าเริ่มต้น: 5
ขั้นต่ำ: 3
สูงสุด: 30
end_imagestringOptional last frame. Use together with image.
voice_idsarrayUp to 2 custom voice IDs so characters speak in that voice. Create one by uploading a 5-30s voice recording at https://www.sandbase.ai/model/kwaivgi/kling-video/create-voice (Kling Create Voice). Cannot be combined with reference videos.
resolutionstringOutput resolution.
ค่าเริ่มต้น: "1080p"
ค่าที่เป็นไปได้: "720p", "1080p", "4k"
aspect_ratiostringOutput frame shape. Leave empty to follow the references (adaptive).
ค่าที่เป็นไปได้: "21:9", "16:9", "9:16", "1:1"
dynamic_rangestringhdr outputs 10-bit HDR video; 1080p and 4k only.
ค่าเริ่มต้น: "sdr"
ค่าที่เป็นไปได้: "sdr", "hdr"
{
"model": "kwaivgi/kling-video/v4",
"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",
"dynamic_range": "sdr"
}run ที่เสร็จสมบูรณ์จะแสดงผลลัพธ์ใน output ต่อไปนี้เป็นตัวอย่างที่บันทึกไว้ของโมเดล ไม่ใช่การสร้างใหม่
ยังไม่มีตัวอย่าง output เผยแพร่ในตอนนี้ ใช้ Playground → Result → JSON หลังจาก run เสร็จสมบูรณ์เพื่อตรวจสอบการตอบกลับของคุณ