imagesarraywymagane
1-10 reference images (JPG/PNG, up to 30 MB, min 300 px, aspect ratio 2:5-5:2), referenced as @Image1, @Image2, ...
kwaivgi/kling-image/v4/editKling Image V4 Edit by Kuaishou edits or recomposes 1 to 10 reference images from a text instruction at native 2K, 4K or 8K resolution.
Wypróbuj model
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
Wybierz przykład, aby wczytać jego dane wejściowe i wynik do playgroundu.
{
"aspect_ratio": "16:9",
"images": [
"https://static.sandbase.ai/examples/af741566-8852-406d-be61-8044f265442c/input/ceb31edd-5be2-40d9-a2fa-7be80bf0160b.png"
],
"prompt": "Place the sneaker from @Image1 on a mossy rock beside a mountain stream at dawn, soft mist, keep the shoe design, colours and the KITO heel tab exactly."
}{
"aspect_ratio": "16:9",
"images": [
"https://static.sandbase.ai/examples/2cfc80be-f125-4f18-8644-bedf004feb6a/input/5bcf3e54-96c8-4a0f-9e71-46b534bf8821.png",
"https://static.sandbase.ai/examples/2cfc80be-f125-4f18-8644-bedf004feb6a/input/0ff16182-a90d-475f-b0c5-f88b3a1c7dc0.png"
],
"prompt": "Create a luxury magazine advertisement: the watch dial from @Image1 fitted with the strap from @Image2, lying on black velvet, headline \"AUREL — Time, Enamelled\" in elegant serif type."
}Kling Image V4 Edit edits or recomposes 1–10 reference images from a text instruction, at native 2K, 4K or 8K.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Refer to inputs as @Image1, @Image2, … |
images | image URL[], required | — | 1–10 images (JPG/PNG, up to 30 MB, at least 300 px per side, aspect ratio 2:5–5:2). |
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. |
Per output image by resolution, plus $0.003 per reference image.
| Request | Price |
|---|---|
| 1 reference, 2K (default) | $0.066 |
| 3 references, 4K | $0.103 |
| 1 reference, 8K | $0.160 |
| 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.
Zacznij tworzyć
Prześlij ten model przez 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/edit",
"prompt": "Turn the scene in @Image1 into a snowy winter evening with warm window light, keep the composition.",
"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"Utwórz klucz API SandBase i ustaw go w środowisku serwera. Wszystkie żądania używają uwierzytelniania Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Przechowuj klucz na serwerze. Nie ujawniaj go w kodzie przeglądarkowym ani nie commituj do repozytorium.
Wyślij POST do /v1/run z tym identyfikatorem modelu i jego danymi wejściowymi. Powyższy przykład żądania obejmuje wysyłanie i odpytywanie statusu.
Użyj zwróconego ID uruchomienia, aby odpytywać status do momentu completion, failed lub timeout. Odczytaj wynik dopiero po completion.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Przekaż publicznie dostępny URL pliku w polu image, video lub audio modelu. Obsługiwane formaty i limity są pokazane obok każdego pola wejściowego w Playground.
Użyj kontrolki upload lub replace w obsługiwanych polach image w Playground. Pola URL wideo akceptują hostowany film źródłowy; nie oznacza to obsługi przesyłania wideo.
imagesarraywymagane1-10 reference images (JPG/PNG, up to 30 MB, min 300 px, aspect ratio 2:5-5:2), referenced as @Image1, @Image2, ...
promptstringwymaganeDescribe the image. Refer to reference images as @Image1, @Image2, ...
num_imagesintegerNumber of independent images to generate (1-9).
Domyślnie: 1
Minimum: 1
Maksimum: 9
resolutionstringOutput resolution. 8K is native ultra-high resolution.
Domyślnie: "2K"
Możliwe wartości: "2K", "4K", "8K"
aspect_ratiostringOutput frame shape. auto picks one from the prompt and references.
Domyślnie: "auto"
Możliwe wartości: "auto", "16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"
{
"model": "kwaivgi/kling-image/v4/edit",
"prompt": "Turn the scene in @Image1 into a snowy winter evening with warm window light, keep the composition.",
"num_images": 1,
"resolution": "2K",
"aspect_ratio": "auto"
}Zakończone uruchomienie udostępnia swój wynik w output. Poniżej znajduje się zapisany przykład modelu, a nie nowa generacja.
[
{
"url": "https://static.sandbase.ai/examples/af741566-8852-406d-be61-8044f265442c/output/b778d304-ecaa-4f46-b016-a6a435c5a075.png"
}
]