imagesarray
Up to 10 reference images, referenced as @Image1, @Image2, ...
kwaivgi/kling-video/v4/reference-to-videoKling V4 Reference to Video by Kuaishou generates a 3-30 second video that keeps characters, objects and motion from reference images and videos.
Modeli deneyin
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
Sırada ne yapmak istersiniz?
Bir örnek seçerek girdilerini ve sonucunu playground'a yükleyin.
{
"aspect_ratio": "16:9",
"images": [
"https://static.sandbase.ai/examples/d5022210-6b33-4763-915b-1bf6b20f4f81/input/454d9f12-340e-487a-8f25-e83ddd48a57b.png"
],
"prompt": "The rabbit from @Image1 sits at a wooden table in a cozy cafe, sipping tea from a tiny cup. Warm afternoon light."
}{
"aspect_ratio": "16:9",
"images": [
"https://static.sandbase.ai/examples/142b1021-7119-4f94-86c5-b7bba08fb8aa/input/60d4b6f5-2b0a-4718-a948-f25624d8589b.png"
],
"prompt": "The tiger from @Image1 walks through a snowy pine forest at dusk, snowflakes falling, low-angle tracking shot."
}Kling V4 reference-to-video keeps characters, objects and motion from reference images and videos in a new 3–30 second clip.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Refer to inputs as @Image1, @Video1, … |
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. Create one at Kling Create Voice. Not combinable with videos. |
aspect_ratio | 21:9 / 16:9 / 9:16 / 1:1 | — | Leave empty to follow the references. |
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, images only (default) | $1.175 |
| 5s, 720p, images only | $0.785 |
| 5s, 4K, images only | $2.745 |
| 5s, 4K, images only, HDR | $3.135 |
| 5s, 1080p, 8s reference video | $1.833 |
| 10s, 720p, 4s reference video | $1.88 |
| Failed runs are not charged. |
voice_id, pass its ID in voice_ids, and write the line in the prompt, e.g. "The man from @Image1 says: "Welcome back."". Every clip has a soundtrack; without voice_ids the voice is chosen by the model.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.
Geliştirmeye başlayın
Bu modeli SandBase Unified Run API üzerinden gönderin.
# 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/reference-to-video",
"prompt": "@Element1 and @Element2 are having dinner at the table in @Image1",
"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"Bir SandBase API anahtarı oluşturun ve sunucu ortamınıza ayarlayın. Tüm istekler Bearer kimlik doğrulaması kullanır.
export SANDBASE_API_KEY="YOUR_API_KEY"Anahtarı sunucuda tutun. Tarayıcı kodunda açığa çıkarmayın veya bir depoya commit etmeyin.
Bu model kimliği ve girdileriyle /v1/run adresine POST gönderin. Yukarıdaki istek örneği gönderme ve yoklamayı içerir.
Durum completed, failed veya timeout olana kadar verilen run ID ile yoklama yapın. Çıktıyı yalnızca completed olduktan sonra okuyun.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Modelin image, video veya audio alanına herkese açık erişilebilir bir dosya URL'si verin. Desteklenen formatlar ve sınırlar her Playground girişinin yanında gösterilir.
Playground'daki desteklenen image alanlarında yükleme veya değiştirme kontrolünü kullanın. Video URL alanları barındırılan bir sürüş videosu kabul eder; video yükleme desteği anlamına gelmez.
imagesarrayUp to 10 reference images, referenced as @Image1, @Image2, ...
promptstringzorunluText prompt. Refer to references 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).
Varsayılan: 5
Minimum: 3
Maksimum: 30
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.
Varsayılan: "1080p"
Olası değerler: "720p", "1080p", "4k"
aspect_ratiostringOutput frame shape. Leave empty to follow the references (adaptive).
Olası değerler: "21:9", "16:9", "9:16", "1:1"
dynamic_rangestringhdr outputs 10-bit HDR video; 1080p and 4k only.
Varsayılan: "sdr"
Olası değerler: "sdr", "hdr"
{
"model": "kwaivgi/kling-video/v4/reference-to-video",
"prompt": "@Element1 and @Element2 are having dinner at the table in @Image1",
"duration": 5,
"resolution": "1080p",
"dynamic_range": "sdr"
}Tamamlanan bir run, sonucunu output içinde gösterir. Aşağıdaki, modelin kaydedilmiş örneğidir; yeni bir üretim değildir.
[
{
"url": "https://static.sandbase.ai/examples/d5022210-6b33-4763-915b-1bf6b20f4f81/output/83773596-daa8-443e-80b4-6a9e2284718b.mp4"
}
]