videostring必填
Video to edit (3-20s, min 700x700 px, up to 300 MB). The output keeps its length.
kwaivgi/kling-video/v4/flash/video-editKling V4 Flash Video Edit by Kuaishou edits a 3-20 second source video into a 720p result from a text instruction and optional reference images.
试用该模型
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
下一步想做什么?
选择一个示例,将其输入和结果加载到 playground 中。
{
"images": [
"https://static.sandbase.ai/examples/e72b57c8-1fef-4fc5-93f8-0473dd8fb581/input/b6aa6d28-155c-42b5-b034-064ed3222127.png",
"https://static.sandbase.ai/examples/e72b57c8-1fef-4fc5-93f8-0473dd8fb581/input/cc34d877-819c-4495-a496-625cee4cc554.png"
],
"prompt": "The blocky car proxy is the KESSEL R4 rally car from @Image1 - chalk-white body with the diagonal signal-orange and charcoal band, black 27 on a white roundel on the doors, slim LED headlamps joined by a light bar, roof scoop, rear wing, red mudflaps, white six-spoke gravel wheels. The grey road ribbon is the loose ochre-grey gravel stage and the cones and cylinders are the pine and birch forest of @Image2, on a crisp autumn morning with low sun raking through the trees and hanging dust. The mannequin proxies behind the rope are rally spectators in muted outdoor jackets and beanies behind red-and-white tape. Keep the exact blocking, timing, camera position and pan of the playblast. Physically real gravel rally: the car slides through the hairpin with opposite lock, rear wheels throwing a thick fan of gravel and a rolling dust cloud that drifts across the spectators; stones rattle off the bank; the suspension works over the ruts; spectators flinch, cheer and raise phones. Sound: a turbocharged four-cylinder rally engine on anti-lag with pops and bangs, gravel spray, crowd cheering. No text other than the number 27, no sponsor logos.",
"video": "https://static.sandbase.ai/examples/e72b57c8-1fef-4fc5-93f8-0473dd8fb581/input/4494b4bf-ff4e-4cc8-ac0d-9895bf65742e.mp4"
}{
"prompt": "Turn the scene in @Video1 into a snowy winter night with falling snowflakes and warm street lamps, keep the paper boat and the camera motion.",
"video": "https://static.sandbase.ai/examples/10c551a4-b8e2-42db-9f69-23eeefe474a4/input/5aeb6a40-0bad-4b5d-b97b-5a031ae1721f.mp4"
}Kling V4 Flash video edit changes a 3–20 second source video from a text instruction, with optional reference images. The 720p 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–20s, min 700×700 px, up to 300 MB. |
images | image URL[] | — | Up to 10 reference images. |
$0.063 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 20 second source when the length cannot be read.
| Source | Price |
|---|---|
| 5s | $0.63 |
| 10s | $1.26 |
| 20s | $2.52 |
| Failed runs are not charged. |
Other Kling V4 Flash endpoints: kwaivgi/kling-video/v4/flash/text-to-video, kwaivgi/kling-video/v4/flash/image-to-video, kwaivgi/kling-video/v4/flash/reference-to-video, kwaivgi/kling-video/v4/flash/video-edit. For 1080p or clips up to 30 seconds, use Kling V4 (kwaivgi/kling-video/v4/text-to-video and its siblings).
开始构建
通过 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/flash/video-edit",
"prompt": "Change the background to a tropical island at sunset."
}
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-20s, 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, ...
{
"model": "kwaivgi/kling-video/v4/flash/video-edit",
"prompt": "Change the background to a tropical island at sunset."
}已完成的运行会在输出中展示结果。以下内容是该模型保存的示例,而不是新的生成结果。
[
{
"url": "https://static.sandbase.ai/examples/e72b57c8-1fef-4fc5-93f8-0473dd8fb581/output/1b1033c7-a1e4-4051-82c4-f2cf9522e9d0.mp4"
}
]