imagesarrayобязательно
The URLs of the images to use for image-to-image generation or image editing.
google/nano-banana-2/editNano Banana 2 is Google's new state-of-the-art image generation and editing model
Попробовать модель
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
Выберите пример, чтобы загрузить его входные данные и результат в playground.
{
"aspect_ratio": "3:2",
"images": [
"https://static.sandbase.ai/examples/c260ffa3-a68a-4042-83e9-22e3edc8e209/input/1473477b-62f4-4256-98a0-f5ad17c3b13f.jpg"
],
"prompt": "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humorous scene."
}Предпочтения людей
Рейтинги Elo по результатам слепых попарных голосований, в сравнении с другими моделями для изображений и видео.
Рейтинги взяты из Artificial Analysis Arena
Arena редактирования изображений: люди выбирают лучший из двух вариантов редактирования одного и того же изображения и инструкции, не видя названий моделей.
Edit or combine images with Nano Banana 2, Google's fast image model. Send images with an instruction to restyle, retouch, swap objects, or merge several inputs into one scene.
| Field | Type | Default | Notes |
|---|---|---|---|
images | image URL[], required | — | Images to edit or combine, Image 1, Image 2, … |
prompt | string, required | — | Up to 50,000 characters. |
aspect_ratio | 21:9 / 16:9 / 3:2 / 4:3 / 5:4 / 1:1 / 4:5 / 3:4 / 2:3 / 9:16 / 4:1 / 1:4 / 8:1 / 1:8 | — | Omit to follow the first input image. |
output_format | jpeg / png | png | Output file format. |
resolution | 0.5K / 1K / 2K / 4K | 1K | Sets the per-image rate. |
enable_web_search | boolean | false | Ground the edit in Google Search results. |
enable_image_search | boolean | false | Use image search results as visual references. |
$0.045 at 0.5K, $0.067 at 1K, $0.101 at 2K, and $0.151 at 4K per image, Google's list price. Input images are not metered. Turning on enable_web_search or enable_image_search adds $0.014 per request (charged once even if both are on).
| Request | 0.5K | 1K | 2K | 4K |
|---|---|---|---|---|
| One image | $0.045 | $0.067 | $0.101 | $0.151 |
Failed runs are not charged.
Other Nano Banana endpoints: google/nano-banana-pro, google/nano-banana-pro/edit, google/nano-banana-2, google/nano-banana-2-lite, google/nano-banana-2-lite/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": "google/nano-banana-2/edit",
"images": [
"https://ai.google.dev/static/gemini-api/docs/images/man_in_white_glasses.jpg"
],
"prompt": "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene.",
"resolution": "1K",
"output_format": "png",
"enable_web_search": false,
"enable_image_search": false
}
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 видео принимают размещённое видео для вождения; это не означает поддержку загрузки видео.
imagesarrayобязательноThe URLs of the images to use for image-to-image generation or image editing.
promptstringобязательноThe text prompt to generate an image from.
По умолчанию: "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene."
resolutionstringThe resolution of the image to generate.
По умолчанию: "1K"
Возможные значения: "0.5K", "1K", "2K", "4K"
aspect_ratiostringThe aspect ratio of the generated image. Leave empty to keep the aspect ratio of the input image.
Возможные значения: "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16", "4:1", "1:4", "8:1", "1:8"
output_formatstringThe format of the generated image.
По умолчанию: "png"
Возможные значения: "jpeg", "png"
enable_web_searchbooleanEnable Google web search grounding to provide background context for image generation.
По умолчанию: false
enable_image_searchbooleanEnable Google image search to retrieve web images as visual background reference for generation.
По умолчанию: false
{
"model": "google/nano-banana-2/edit",
"images": [
"https://ai.google.dev/static/gemini-api/docs/images/man_in_white_glasses.jpg"
],
"prompt": "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene.",
"resolution": "1K",
"output_format": "png",
"enable_web_search": false,
"enable_image_search": false
}В завершённом запуске результат доступен в output. Ниже приведён сохранённый пример модели, а не новая генерация.
[
{
"source": "Google AI for Developers",
"source_url": "https://ai.google.dev/gemini-api/docs/image-generation",
"url": "https://static.sandbase.ai/examples/c260ffa3-a68a-4042-83e9-22e3edc8e209/output/6ef1e332-af29-43c9-82db-b612324ca650.jpg"
}
]