nano-banana-pro-openrouter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nano Banana Pro OpenRouter

Nano Banana Pro OpenRouter

Overview

概述

Generate or edit images with OpenRouter using the
google/gemini-3-pro-image-preview
model. Support prompt-only generation, single-image edits, and multi-image composition.
通过OpenRouter使用
google/gemini-3-pro-image-preview
模型生成或编辑图片。支持仅用提示词生成、单张图片编辑以及多图片合成。

Prompt-only generation

仅用提示词生成图片

uv run {baseDir}/scripts/generate_image.py \
  --prompt "A cinematic sunset over snow-capped mountains" \
  --filename sunset.png
uv run {baseDir}/scripts/generate_image.py \
  --prompt "A cinematic sunset over snow-capped mountains" \
  --filename sunset.png

Edit a single image

编辑单张图片

uv run {baseDir}/scripts/generate_image.py \
  --prompt "Replace the sky with a dramatic aurora" \
  --input-image input.jpg \
  --filename aurora.png
uv run {baseDir}/scripts/generate_image.py \
  --prompt "Replace the sky with a dramatic aurora" \
  --input-image input.jpg \
  --filename aurora.png

Compose multiple images

合成多张图片

uv run {baseDir}/scripts/generate_image.py \
  --prompt "Combine the subjects into a single studio portrait" \
  --input-image face1.jpg \
  --input-image face2.jpg \
  --filename composite.png
uv run {baseDir}/scripts/generate_image.py \
  --prompt "Combine the subjects into a single studio portrait" \
  --input-image face1.jpg \
  --input-image face2.jpg \
  --filename composite.png

Resolution

分辨率

  • Use
    --resolution
    with
    1K
    ,
    2K
    , or
    4K
    .
  • Default is
    1K
    if not specified.
  • 使用
    --resolution
    参数指定
    1K
    2K
    4K
    分辨率。
  • 若未指定,默认分辨率为
    1K

System prompt customization

系统提示词自定义

The skill reads an optional system prompt from
assets/SYSTEM_TEMPLATE
. This allows you to customize the image generation behavior without modifying code.
该技能可从
assets/SYSTEM_TEMPLATE
读取可选的系统提示词。无需修改代码即可自定义图片生成行为。

Behavior and constraints

行为与限制

  • Accept up to 3 input images via repeated
    --input-image
    .
  • --filename
    accepts relative paths (saves to current directory) or absolute paths.
  • If multiple images are returned, append
    -1
    ,
    -2
    , etc. to the filename.
  • Print
    MEDIA: <path>
    for each saved image. Do not read images back into the response.
  • 通过重复使用
    --input-image
    参数,最多可接受3张输入图片。
  • --filename
    参数支持相对路径(保存至当前目录)或绝对路径。
  • 若返回多张图片,会在文件名后追加
    -1
    -2
    等后缀。
  • 每张保存的图片都会输出
    MEDIA: <path>
    ,请勿将图片读回响应中。

Troubleshooting

故障排查

If the script exits non-zero, check stderr against these common blockers:
SymptomResolution
OPENROUTER_API_KEY is not set
Ask the user to set it. PowerShell:
$env:OPENROUTER_API_KEY = "sk-or-..."
/ bash:
export OPENROUTER_API_KEY="sk-or-..."
uv: command not found
or not recognized
macOS/Linux: <code>curl -LsSf https://astral.sh/uv/install.sh | sh</code>. Windows: <code>powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"</code>. Then restart the terminal.
AuthenticationError
/ HTTP 401
Key is invalid or has no credits. Verify at https://openrouter.ai/settings/keys.
For transient errors (HTTP 429, network timeouts), retry once after 30 seconds. Do not retry the same error more than twice — surface the issue to the user instead.
如果脚本非零退出,请对照以下常见问题检查标准错误输出:
症状解决方法
OPENROUTER_API_KEY is not set
请用户设置该环境变量。PowerShell:
$env:OPENROUTER_API_KEY = "sk-or-..."
/ bash:
export OPENROUTER_API_KEY="sk-or-..."
uv: command not found
或未被识别
macOS/Linux:<code>curl -LsSf https://astral.sh/uv/install.sh | sh</code>。Windows:<code>powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"</code>。然后重启终端。
AuthenticationError
/ HTTP 401
API密钥无效或无可用额度。请在https://openrouter.ai/settings/keys验证。
对于临时错误(如HTTP 429、网络超时),等待30秒后重试一次。同一错误请勿重试超过两次,而是将问题告知用户。