videostring必填
Video to edit (3-30s, min 700x700 px, up to 300 MB). The output keeps its length.
kwaivgi/kling-video/v4/video-editKling V4 Video Edit by Kuaishou edits a 3-30 second source video from a text instruction and optional reference images.
試用這個模型
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
接下來您想做什麼?
選擇一個範例,將其輸入與結果載入 playground。
{
"prompt": "Change the time of day in @Video1 to a starry night with the boat glowing softly, keep the camera motion.",
"video": "https://static.sandbase.ai/examples/c5782511-455d-4642-aed4-aee4d9a68521/input/cc801f7f-f034-4822-99db-04c72e2b9743.mp4"
}{
"prompt": "Restyle @Video1 as a hand-drawn watercolor animation, keep the vendor's motion and the flames.",
"video": "https://static.sandbase.ai/examples/8bd56a37-82da-4689-bfeb-b3d6e6db43dd/input/0ff13888-7225-4b82-bbe3-0ddbcabe39d0.mp4"
}Kling V4 video edit changes a 3–30 second source video from a text instruction, with optional reference images. The output keeps the source length.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Edit instruction. Refer to the source as @Video1 and images as @Image1, … |
video | video URL, required | — | 3–30s, min 700×700 px, up to 300 MB. |
images | image URL[] | — | Up to 10 reference images. |
resolution | 720p / 1080p / 4k | 1080p | Output resolution. |
dynamic_range | sdr / hdr | sdr | hdr outputs 10-bit HDR video. 1080p and 4k only. |
$0.094 (720p), $0.141 (1080p) or $0.329 (4K) per second, counted on input plus output (2× the source length). Settlement uses the output length (it matches the source); the quote before submission assumes a 30 second source when the length cannot be read. HDR adds $0.047 per output second at 1080p and $0.078 at 4K.
| Source | Price |
|---|---|
| 6s, 1080p | $1.692 |
| 10s, 720p | $1.88 |
| 10s, 4K | $6.58 |
| 10s, 4K, HDR | $7.36 |
| 30s, 1080p | $8.46 |
| 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.
開始建置
透過 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/video-edit",
"prompt": "Change the background to a tropical island at sunset.",
"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 金鑰,並將其設定在伺服器環境中。所有請求都使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開,也不要提交到儲存庫。
使用此模型 ID 及其輸入,向 /v1/run 發送 POST。上方的請求範例包含提交與輪詢。
使用回傳的執行 ID 持續輪詢,直到狀態為 completed、failed 或 timeout。只有在 completed 之後才讀取輸出。
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"在模型的 image、video 或 audio 欄位中傳入可公開存取的檔案 URL。支援格式與限制會顯示在每個 Playground 輸入欄位旁。
在 Playground 中支援的圖片欄位上使用上傳或取代控制項。影片 URL 欄位可接受託管的 driving video;它們不代表支援影片上傳。
videostring必填Video to edit (3-30s, min 700x700 px, up to 300 MB). The output keeps its length.
imagesarrayOptional reference images, referenced as @Image1, @Image2, ...
promptstring必填Edit instruction. Refer to the source video as @Video1 and reference images as @Image1, @Image2, ...
resolutionstringOutput resolution.
預設:"1080p"
可能值:"720p", "1080p", "4k"
dynamic_rangestringhdr outputs 10-bit HDR video; 1080p and 4k only.
預設:"sdr"
可能值:"sdr", "hdr"
{
"model": "kwaivgi/kling-video/v4/video-edit",
"prompt": "Change the background to a tropical island at sunset.",
"resolution": "1080p",
"dynamic_range": "sdr"
}已完成的執行會在輸出中顯示結果。以下為模型已儲存的範例,並非新的生成結果。
[
{
"url": "https://static.sandbase.ai/examples/c5782511-455d-4642-aed4-aee4d9a68521/output/e7edbd9a-0c29-4b45-8e1d-701fba8ef596.mp4"
}
]