promptstringобязательно
Describe the image. Refer to reference images as @Image1, @Image2, ...
kwaivgi/kling-image/v4Kling Image V4 by Kuaishou generates photorealistic images with accurate text rendering from a text prompt at native 2K, 4K or 8K resolution.
Попробовать модель
Выберите пример, чтобы загрузить его входные данные и результат в playground.
{
"aspect_ratio": "16:9",
"prompt": "Event poster for a jazz night: a saxophonist silhouetted against a deep blue stage light, large title \"MIDNIGHT JAZZ\" in bold Art Deco letters, smaller line \"Friday 22 November · Blue Room · 9 PM\" at the bottom, grainy film texture."
}{
"aspect_ratio": "16:9",
"prompt": "Camera-like photograph of an elderly fisherman mending a net on a wooden pier at golden hour, weathered skin and knitted sweater in fine detail, shallow depth of field, 85mm lens."
}Kling Image V4 generates photorealistic images from a text prompt at native 2K, 4K or 8K, with sharp in-image text (up to about 2,000 characters, multilingual) and dense layouts.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Put any text to render in quotation marks. |
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. |
Billed per output image by resolution.
| Resolution | Per image |
|---|---|
| 2K (default) | $0.063 |
| 4K | $0.094 |
| 8K | $0.157 |
| 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.
Начните разработку
Отправьте эту модель через 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",
"prompt": "A faceted glass perfume bottle on wet black slate, soft rim light, a small card beside it printed with \"NOCTURNE\" in thin serif letters, macro product photography.",
"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"Создайте ключ SandBase API и задайте его в окружении сервера. Все запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Храните ключ на сервере. Не раскрывайте его в коде браузера и не коммитьте в репозиторий.
Отправьте POST на /v1/run с этим ID модели и её входными данными. Пример запроса выше включает отправку и опрос.
Используйте возвращённый ID запуска, чтобы опрашивать статус до завершения, ошибки или таймаута. Читайте вывод только после завершения.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Передайте публично доступный URL файла в поле image, video или audio модели. Поддерживаемые форматы и лимиты показаны рядом с каждым полем Playground.
Используйте управление загрузкой или заменой в поддерживаемых полях изображений в Playground. Поля URL видео принимают размещённое видео для вождения; это не означает поддержку загрузки видео.
promptstringобязательноDescribe the image. Refer to reference images as @Image1, @Image2, ...
num_imagesintegerNumber of independent images to generate (1-9).
По умолчанию: 1
Минимум: 1
Максимум: 9
resolutionstringOutput resolution. 8K is native ultra-high resolution.
По умолчанию: "2K"
Возможные значения: "2K", "4K", "8K"
aspect_ratiostringOutput frame shape. auto picks one from the prompt and references.
По умолчанию: "auto"
Возможные значения: "auto", "16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9"
{
"model": "kwaivgi/kling-image/v4",
"prompt": "A faceted glass perfume bottle on wet black slate, soft rim light, a small card beside it printed with \"NOCTURNE\" in thin serif letters, macro product photography.",
"num_images": 1,
"resolution": "2K",
"aspect_ratio": "auto"
}В завершённом запуске результат доступен в output. Ниже приведён сохранённый пример модели, а не новая генерация.
[
{
"url": "https://static.sandbase.ai/examples/bcc829ad-1640-449e-9efa-04cf84da1d97/output/04854f77-94c7-469a-908e-4f743ba7ea16.png"
}
]