nano-banana
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano Banana Image Generation & Editing
Nano Banana图像生成与编辑
Generate new images or edit existing ones using Google's Gemini image API.
Default model: Nano Banana 2 () — cheaper, faster, more features.
Legacy model: Nano Banana Pro () — available via , deprecated 9 March 2026.
gemini-3.1-flash-image-previewgemini-3-pro-image-preview--model nano-banana-pro使用Google的Gemini图像API生成新图像或编辑现有图像。
默认模型: Nano Banana 2()——成本更低、速度更快、功能更多。
旧版模型: Nano Banana Pro()——可通过参数使用,将于2026年3月9日停止支持。
gemini-3.1-flash-image-previewgemini-3-pro-image-preview--model nano-banana-proUsage
使用说明
Run the script using absolute path (do NOT cd to skill directory first):
Generate new image:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "your image description" --filename "output.png" [--resolution 0.5K|1K|2K|4K] [--aspect-ratio 16:9] [--thinking high] [--api-key KEY]Edit existing image:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "editing instructions" --filename "output.png" --input-image "path/to/input.png" [--resolution 0.5K|1K|2K|4K] [--api-key KEY]Multi-reference generation (up to 14 images):
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "combine these styles" --filename "output.png" --input-image "ref1.png" --input-image "ref2.png"Important: Always run from the user's current working directory so images are saved where the user is working, not in the skill directory.
使用绝对路径运行脚本(请勿先cd到技能目录):
生成新图像:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "your image description" --filename "output.png" [--resolution 0.5K|1K|2K|4K] [--aspect-ratio 16:9] [--thinking high] [--api-key KEY]编辑现有图像:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "editing instructions" --filename "output.png" --input-image "path/to/input.png" [--resolution 0.5K|1K|2K|4K] [--api-key KEY]多参考图生成(最多14张图像):
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "combine these styles" --filename "output.png" --input-image "ref1.png" --input-image "ref2.png"重要提示: 请始终在用户当前工作目录下运行脚本,这样图像会保存在用户正在操作的目录下,而非技能目录中。
Model Selection
模型选择
| Flag value | Model ID | Notes |
|---|---|---|
| | Cheaper, faster, 0.5K support, aspect ratio, thinking, 14 ref images |
| | Deprecated 9 March 2026 |
| 参数值 | 模型ID | 备注 |
|---|---|---|
| | 成本更低、速度更快,支持0.5K分辨率、宽高比设置、思考级别调整、最多14张参考图 |
| | 2026年3月9日停止支持 |
Resolution Options
分辨率选项
Uppercase K required:
- 0.5K — ~512px (cheapest, Nano Banana 2 only)
- 1K (default) — ~1024px
- 2K — ~2048px
- 4K — ~4096px
Map user requests:
- "thumbnail", "small", "cheap", "low resolution" →
0.5K - No mention / "1080", "1080p", "1K" →
1K - "2K", "2048", "medium resolution" →
2K - "high resolution", "high-res", "hi-res", "4K", "ultra" →
4K
When editing, resolution auto-detects from input image size if not specified.
必须使用大写的K:
- 0.5K — ~512px(成本最低,仅Nano Banana 2支持)
- 1K (默认) — ~1024px
- 2K — ~2048px
- 4K — ~4096px
用户请求映射规则:
- “缩略图”、“小尺寸”、“低成本”、“低分辨率” →
0.5K - 未说明/“1080”、“1080p”、“1K” →
1K - “2K”、“2048”、“中等分辨率” →
2K - “高分辨率”、“high-res”、“hi-res”、“4K”、“超清” →
4K
编辑图像时如果未指定分辨率,会自动根据输入图像的尺寸检测分辨率。
Aspect Ratio
宽高比
14 supported ratios (Nano Banana 2 only). Omit to let the API decide.
Map user requests:
- "landscape", "wide" →
16:9 - "portrait", "phone", "story", "reel" →
9:16 - "square" →
1:1 - "cinematic", "ultrawide" →
21:9 - "photo portrait" → or
3:42:3
支持14种宽高比(仅Nano Banana 2支持),不指定的话将由API自动决定。
用户请求映射规则:
- “横版”、“宽屏” →
16:9 - “竖版”、“手机端”、“故事”、“短视频” →
9:16 - “正方形” →
1:1 - “电影感”、“超宽屏” →
21:9 - “人像照片” → 或
3:42:3
Thinking
思考级别
Controls reasoning effort for complex prompts (Nano Banana 2 only). Omit for fastest/cheapest.
- — slightly better quality, low latency impact
--thinking minimal - — best for complex composition, text rendering, detailed scenes
--thinking high
Note: thinking tokens are billed regardless of level.
控制处理复杂提示词的推理投入(仅Nano Banana 2支持),不指定的话将采用最快/最低成本的模式。
- — 画质小幅提升,延迟影响小
--thinking minimal - — 最适合复杂构图、文字渲染、细节丰富的场景
--thinking high
注意:无论选择哪个级别,思考token都会正常计费。
Reference Images
参考图像
Up to 14 input images via repeated flags. Use cases:
--input-image- Style transfer — provide style reference + subject
- Character consistency — provide character reference images
- Object reference — provide object images to include
- Image editing — provide single image + editing instructions in prompt
Resolution auto-detects from the first input image when not specified.
--resolution通过重复传入参数最多可添加14张输入图像,适用场景:
--input-image- 风格迁移——提供风格参考图+主体图
- 人物一致性——提供人物参考图像
- 物体参考——提供要包含的物体图像
- 图像编辑——提供单张图像+提示词中的编辑指令
未指定时,会自动根据第一张输入图像检测分辨率。
--resolutionAPI Key
API Key
Checked in order:
- argument
--api-key - environment variable
GEMINI_API_KEY
按以下顺序读取:
- 参数
--api-key - 环境变量
GEMINI_API_KEY
Filename Generation
文件名生成规则
Pattern:
yyyy-mm-dd-hh-mm-ss-name.png- Timestamp: current date/time, 24-hour format
- Name: descriptive lowercase with hyphens (1-5 words)
- Unclear context: use random identifier (e.g., )
x9k2
Examples:
- "A serene Japanese garden" →
2026-03-01-14-23-05-japanese-garden.png - Unclear →
2026-03-01-17-12-48-x9k2.png
命名模式:
yyyy-mm-dd-hh-mm-ss-name.png- 时间戳:当前日期时间,24小时制
- 名称:描述性小写字母+连字符(1-5个单词)
- 上下文不明确时:使用随机标识符(例如)
x9k2
示例:
- “静谧的日式花园” →
2026-03-01-14-23-05-japanese-garden.png - 上下文不明确 →
2026-03-01-17-12-48-x9k2.png
Image Editing
图像编辑
- Check if user provides an image path or references an image in the current directory
- Use with the path
--input-image - Pass editing instructions in
--prompt - Common tasks: add/remove elements, change style, adjust colours, blur background
- 检查用户是否提供了图像路径,或者引用了当前目录下的图像
- 在参数中传入路径
--input-image - 在参数中传入编辑指令
--prompt - 常见任务:添加/移除元素、更改风格、调整颜色、模糊背景
Prompt Handling
提示词处理
For generation: Pass user's image description as-is to . Only rework if clearly insufficient.
--promptFor editing: Pass editing instructions in (e.g., "add a rainbow in the sky", "make it look like a watercolour painting")
--promptPreserve user's creative intent in both cases.
生成场景: 将用户的图像描述原样传入参数,仅在描述明显不完整时才进行调整。
--prompt编辑场景: 将编辑指令传入参数(例如“在天空中添加一道彩虹”、“改成水彩画风格”)
--prompt两种场景都要保留用户的创作意图。
Output
输出
- Saves PNG to current directory (or specified path if filename includes directory)
- Script outputs the full path to the generated image
- Do not read the image back — just inform the user of the saved path
- 将PNG文件保存到当前目录(如果文件名包含路径则保存到指定路径)
- 脚本会输出生成图像的完整路径
- 请勿回读图像——只需告知用户保存路径即可
Pricing (Paid Tier Only)
定价(仅付费层级)
No free tier for image generation.
图像生成无免费额度。
Nano Banana 2 (gemini-3.1-flash-image-preview
) — default
gemini-3.1-flash-image-previewNano Banana 2(gemini-3.1-flash-image-preview
)——默认
gemini-3.1-flash-image-preview| Resolution | Standard | Batch |
|---|---|---|
| 0.5K (512px) | $0.045 | $0.022 |
| 1K | $0.067 | $0.034 |
| 2K | $0.101 | $0.050 |
| 4K | $0.151 | $0.076 |
Google Search grounding: 5,000 prompts/month free, then $14/1,000 queries.
| 分辨率 | 标准价 | 批量价 |
|---|---|---|
| 0.5K (512px) | $0.045 | $0.022 |
| 1K | $0.067 | $0.034 |
| 2K | $0.101 | $0.050 |
| 4K | $0.151 | $0.076 |
谷歌搜索 grounding:每月前5000次提示免费,超出后按14美元/1000次查询计费。
Nano Banana Pro (gemini-3-pro-image-preview
) — deprecated 9 Mar 2026
gemini-3-pro-image-previewNano Banana Pro(gemini-3-pro-image-preview
)——2026年3月9日停止支持
gemini-3-pro-image-preview| Component | Standard | Batch |
|---|---|---|
| Input (per image) | $0.0011 | $0.0006 |
| Output 1K/2K | $0.134 | $0.067 |
| Output 4K | $0.24 | $0.12 |
| 计费项 | 标准价 | 批量价 |
|---|---|---|
| 输入(每张图像) | $0.0011 | $0.0006 |
| 输出 1K/2K | $0.134 | $0.067 |
| 输出 4K | $0.24 | $0.12 |
Examples
示例
Generate with aspect ratio:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "Cinematic landscape at golden hour" --filename "2026-03-01-10-00-00-landscape.png" --resolution 2K --aspect-ratio 21:9Generate with thinking for complex prompt:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A detailed infographic about climate change with text labels" --filename "2026-03-01-10-05-00-infographic.png" --thinking high --resolution 4KMulti-reference style transfer:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A portrait in this artistic style" --filename "2026-03-01-10-10-00-styled-portrait.png" --input-image "style-ref.png" --input-image "subject.png"Budget thumbnail:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "Simple icon of a house" --filename "2026-03-01-10-15-00-house-icon.png" --resolution 0.5KEdit existing image:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "make the sky more dramatic with storm clouds" --filename "2026-03-01-14-25-30-dramatic-sky.png" --input-image "original-photo.jpg" --resolution 2KUse legacy model:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A serene Japanese garden" --filename "2026-03-01-14-23-05-japanese-garden.png" --model nano-banana-pro --resolution 4K指定宽高比生成:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "Cinematic landscape at golden hour" --filename "2026-03-01-10-00-00-landscape.png" --resolution 2K --aspect-ratio 21:9复杂提示词指定思考级别生成:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A detailed infographic about climate change with text labels" --filename "2026-03-01-10-05-00-infographic.png" --thinking high --resolution 4K多参考图风格迁移:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A portrait in this artistic style" --filename "2026-03-01-10-10-00-styled-portrait.png" --input-image "style-ref.png" --input-image "subject.png"低成本缩略图生成:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "Simple icon of a house" --filename "2026-03-01-10-15-00-house-icon.png" --resolution 0.5K编辑现有图像:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "make the sky more dramatic with storm clouds" --filename "2026-03-01-14-25-30-dramatic-sky.png" --input-image "original-photo.jpg" --resolution 2K使用旧版模型:
bash
uv run ~/.claude/skills/nano-banana/scripts/generate_image.py --prompt "A serene Japanese garden" --filename "2026-03-01-14-23-05-japanese-garden.png" --model nano-banana-pro --resolution 4K