pi-banana

extensionmaintained

Generate, edit, and analyze images in pi using Google Nano Banana (image gen) and Gemini Vision (analysis). Inline terminal preview, reference-image editing, auto-save.

by · v2.3.0 · published 2mo ago

$ pi install npm:pi-banana
downloads/mo
0
stars
2
last push
1mo ago
open issues
0

Signals

license: MITtestspi manifest: missinginstall size: —deps: 0peer deps: 0

Download trend

829 downloads · last 12 weeks (weekly)

README

pi-banana

pi-banana banner

Generate, edit, and analyze images directly inside pi using Google's Nano Banana 2 (gemini-3.1-flash-image-preview), Nano Banana Pro (gemini-3-pro-image-preview), and Gemini Vision.

  • Image Generation & Editing — Create images from scratch or pass referenceImages: ["./logo.png"] to edit existing pictures.
  • Multimodal Vision — Analyze, describe, or extract text from images using gemini-3.1-flash-lite (fast) or gemini-3.1-pro-preview (deep reasoning).
  • Inline preview in Kitty / iTerm2 / WezTerm — generated images show up right under the tool call.
  • Auto-save to ./generated/ so the agent and you both have a real file to refer back to.
  • One env varGOOGLE_API_KEY. Works with both AI Studio (AIza…) and Vertex AI Express (AQ.…) keys.

Install

pi install pi-banana

If pi doesn't resolve the bare name, use the explicit form: pi install npm:pi-banana.

Or for a single-session try:

pi -e pi-banana   # or: pi -e npm:pi-banana

Then export your key:

export GOOGLE_API_KEY="AIza…"   # AI Studio key, or
export GOOGLE_API_KEY="AQ.…"    # Vertex AI Express key

Get one at aistudio.google.com/apikey.

Usage

Just ask pi for what you want:

"Generate a 16:9 wallpaper of a foggy redwood forest at dawn"

"Edit ./generated/logo-20260508.png — make the background transparent"

"What color is the car in ./assets/photo.jpg?"

"Extract the text from these three receipts."

The model calls banana_image or banana_vision automatically.

Tools

1. banana_image

Renamed from generate_image in v2.0.1 to avoid colliding with @benvargas/pi-antigravity-image-gen. Both extensions can now coexist in the same pi install.

ParamTypeDefaultDescription
promptstringRequired. What to draw, or what to change about the reference image.
aspectRatioenum1:11:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
imageSizeenum1K1K, 2K, 4K. 4K requires quality=high.
qualityenumfastfast = Nano Banana 2 (~3–10 s, cheapest). high = Nano Banana Pro (slower, top quality).
referenceImagesarrayOptional array of paths (PNG/JPEG/WebP/GIF) to edit or use for composition instead of generating from scratch.
outputPathstring./generated/<slug>-<ts>.pngOptional output path. Parent dirs are created.

2. banana_vision

ParamTypeDefaultDescription
promptstringRequired. What you want to know about the image(s) (e.g. 'Describe this image', 'Extract the text').
imagePathsarrayRequired. Array of paths to existing images to analyze.
qualityenumfastfast = gemini-3.1-flash-lite (fast/cheap). high = gemini-3.1-pro-preview (slower, deep reasoning).

Configuration

Two env vars adjust defaults without touching tool parameters:

Env varDefaultEffect
PI_IMAGE_DIRgeneratedDefault save directory (relative paths resolve against cwd).
PI_IMAGE_QUALITYfastDefault quality if the model doesn't pass one.

How is this different from @benvargas/pi-antigravity-image-gen?

pi-banana@benvargas
AuthGOOGLE_API_KEY env varOAuth via Antigravity (pi /login)
ModelsFlash + ProPro only
Image edit (input picture)
Auto-save default✅ to ./generated/❌ disabled by default
Aspect ratios1010
Inline terminal preview

If you have an Antigravity OAuth setup and want quota tracking, benvargas is great. If you just want to drop in an API key and start making pictures, this one is simpler.

From the same author

By Francesco Frapporti at Fornace.

  • pi-bench — LLM benchmark toolkit for pi. Probes every available model to find the fastest and cheapest. All package banners in this ecosystem were created with pi-banana.
  • pi-recap — Always-visible session recap panel for pi. Never scroll back to remember what you were doing.
  • pi-alibaba-models — Complete Alibaba provider for pi: Qwen, DeepSeek, Kimi, GLM, MiniMax with native thinking levels.
  • pi-notte-theme — Notte: a true-dark pi theme where darkness has color and text glows like terminal phosphor.

Development

npm install
npm run typecheck             # tsc --noEmit
GOOGLE_API_KEY=… npm run smoke  # full live-API smoke test in _tmp/

License

MIT