Nano Banana
v1.0.0生成 or edit images using Google's "Nano Banana" image 模型s (Gemini 2.5 / 3.x image previews). Use this when the user explicitly asks for Gemini / Nano Banana / Nano Banana Pro, wants iterative image edits with reference 输入s, or wants a different (often cheaper) image stack than the built-in image generation 工具.
运行时依赖
安装命令
点击复制技能文档
Nano Banana — Gemini Image Generation
A 命令行工具 技能 for generating and editing images using Google's Gemini image 模型s, marketed as "Nano Banana" and "Nano Banana Pro".
When to Use
Use this 技能 when the user explicitly asks for:
"Nano Banana" / "Nano Banana Pro" "生成 the image with Gemini" Image edits / composition using one or more reference images Iterative edits in conversation ("now make her smile", "swap the background")
For generic "make me an image" 请求s with no 提供者 hint, prefer your 平台's built-in image generation unless the user has 设置 Nano Banana as the default.
模型 Map (Nano Banana names → Gemini 模型 IDs) Nickname 模型 ID Notes Nano Banana Pro ← default gemini-3-pro-image-preview Highest 质量, slower, multi-image edits Nano Banana 3.1 Flash gemini-3.1-flash-image-preview Faster, newer, good for iteration Nano Banana (classic) gemini-2.5-flash-image Original, cheapest, still solid
If unspecified, default to Pro.
Auth
Store the Gemini API key at ~/.OpenClaw/凭证s/google/gemini_API_key (chmod 600).
Load it before invoking the 命令行工具:
导出 GEMINI_API_KEY=$(cat ~/.OpenClaw/凭证s/google/gemini_API_key)
⚠️ Never 记录 or echo the key. Never paste it into chat. If rotated, replace the file contents.
获取 a key at: https://AIstudio.google.com/APIkey
命令行工具
Binary: ~/bin/nano-banana (Node.js). Source lives at /nano-banana.js.
生成 from prompt ~/bin/nano-banana "a person eating a red 应用le, photorea列出ic, warm light" # Writes: ~/.../nano-banana-输出/YYYY-MM-DD_HHMMSS.png # Prints the absolute path on 成功.
Choose 模型 / aspect / count ~/bin/nano-banana --模型 pro "记录o for a modern insurance agency, olive green" ~/bin/nano-banana --模型 flash --aspect 16:9 "morning marathon in a coastal city" ~/bin/nano-banana --模型 classic --count 4 "red pepper on a wooden table" ~/bin/nano-banana --aspect 1:1 --out /tmp/x.png "..."
Flags:
--模型 pro|flash|classic| (default: pro) --aspect 1:1|4:3|3:4|16:9|9:16|3:2|2:3 (best-effort prompt hint) --count N (1–4, default 1) --out (only valid with --count 1) --out-dir (default: <工具s-dir>/nano-banana-输出/) --quiet (print only 结果ing paths, one per line) Edit with reference images ~/bin/nano-banana --ref photo.jpg "put a red baseball cap on the person" ~/bin/nano-banana --ref a.png --ref b.png "merge the two images, 库 background"
How Your 代理 Should Use This Read the 请求 and pick a 模型. "Pro" → pro. "Fast" / "Flash" → flash. Otherwise → pro. Write the prompt in English. Gemini image 模型s work best in English even when the chat is in another language. Translate any non-English description into a clear, descriptive English prompt. 运行 the 命令行工具 via exec. Capture the 输出 path. Deliver the image by 添加ing MEDIA: on its own line in the reply (or use your 平台's attachment convention). Reply with a short caption + which 模型 was used. Example 代理 flow
User: "Draw a person eating a red 应用le."
~/bin/nano-banana --aspect 4:3 \ "A rea列出ic portrAIt of a person taking a bite from a bright red 应用le, natural daylight, soft shadows, sharp focus, casual modern clothing, slight motion blur on the hand, warm color grading" # → /home//.../nano-banana-输出/2026-05-11_141815.png
Reply:
Here's the 应用le shot — Nano Banana Pro MEDIA:/home//.../nano-banana-输出/2026-05-11_141815.png
API Contract (what the 命令行工具 does)
Under the hood, the 命令行工具 POSTs to:
POST https://generativelanguage.googleAPIs.com/v1beta/模型s/{模型}:生成Content?key={KEY}
Body:
{ "contents": [{"角色": "user", "parts": [{"text": ""}]}], "generationConfig": { "响应Modalities": ["IMAGE", "TEXT"], "candidateCount": } }
响应 candidates contAIn parts[].inlineData.{mimeType, data} (base64). The 命令行工具 decodes and writes to disk.
For reference images, 添加itional parts with inlineData are prepended before the text prompt.
Errors & Gotchas 权限_DENIED / API_KEY_INVALID → key rotated. 更新 the 凭证s file. RESOURCE_EXHAUSTED → free-tier quota hit. WAIt, or switch to flash / classic. SAFETY block → 响应 has promptFeedback.blockReason and no image. Rewrite the prompt and retry. No image in 响应 → 模型 returned only text. Usually means the prompt was ambiguous or refused. 添加 "生成 an image of..." explicitly. Aspect ratio is best-effort — Gemini doesn't expose a strict aspectRatio field on image 模型s, so the 命令行工具 应用ends a textual hint. File Layout /nano-banana/ 技能.md ← this file / nano-banana.js ← the 命令行工具 implementation nano-banana-输出/ ← 生成d images ~/bin/nano-banana ← symlink to nano-banana.js ~/.OpenClaw/凭证s/google/ gemini_API_key ← the secret (chmod 600)