
nanobanana
AI image generation and editing plugin built on Google Gemini 3 Pro Image with reusable style templates.
- version
- 2.3.0
- GitHub stars
- 289
What it does
- Adds
/generate,/edit, and/stylecommands plusimage-generatorandstyle-manageragents for image work - Covers text-to-image, image editing, reference images, batch variations, and eight aspect ratios from 1:1 to 21:9
- Applies markdown style files from
styles/to prompts, with/stylehandling create, list, show, update, and delete - Designed for designers and content creators who need consistent visual styles across icons, thumbnails, and photo edits
AI image generation and editing using Google Gemini 3 Pro Image API. v2.3.0: Added explicit name: fields to commands for prefix-free invocation (/generate instead of /nanobanana:generate). Simple Node.js CLI with markdown styles and batch generation.
Add marketplace
/plugin marketplace add MadAppGang/claude-codeRun it inside Claude Code once, then install the plugin below.
Install
/plugin install nanobanana@mag-claude-pluginsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceplugin: nanobanana updated: 2026-01-20
Gemini Image API Reference
Quick Start
# Set API key
export GEMINI_API_KEY="your-key"
# Generate image
uv run python main.py output.png "A minimal 3D cube"
API Key Setup
- Visit: https://makersuite.google.com/app/apikey
- Create new API key
- Set environment variable:
export GEMINI_API_KEY="your-api-key"
Supported Models
| Model | Resolution | Best For |
|---|---|---|
| gemini-3-pro-image-preview | Up to 4K | High quality |
| gemini-2.5-flash-image | Up to 1K | Quick iterations |
Aspect Ratios
| Ratio | Use Case |
|---|---|
| 1:1 | Social media, icons |
| 3:4 | Portrait photos |
| 4:3 | Traditional photos |
| 4:5 | Instagram portrait |
| 5:4 | Landscape photos |
| 9:16 | Mobile, stories |
| 16:9 | YouTube, desktop |
| 21:9 | Cinematic, ultrawide |
CLI Flags
| Flag | Description | Example |
|---|---|---|
--style | Apply style template | --style styles/glass.md |
--edit | Edit existing image | --edit photo.jpg |
--ref | Reference image | --ref style.png |
--aspect | Aspect ratio | --aspect 16:9 |
--model | Model ID | --model gemini-2.5-flash-image |
--max-retries | Retry attempts | --max-retries 5 |
Error Codes
| Code | Meaning | Recovery |
|---|---|---|
SUCCESS | Operation completed | N/A |
API_KEY_MISSING | GEMINI_API_KEY not set | Export the variable |
FILE_NOT_FOUND | Referenced file missing | Check path |
INVALID_INPUT | Bad prompt or argument | Fix input |
RATE_LIMITED | Too many requests | Wait, uses auto-retry |
NETWORK_ERROR | Connection failed | Check network, auto-retry |
API_ERROR | Gemini API error | Check logs |
CONTENT_POLICY | Blocked prompt | Adjust content |
TIMEOUT | Request timed out | Retry |
PARTIAL_FAILURE | Some batch items failed | Check individual results |
Retry Behavior
The script automatically retries on transient errors:
- Rate limits (429)
- Server errors (502, 503)
- Connection timeouts
- Network errors
Retry uses exponential backoff: 1s, 2s, 4s, 8s, etc.
Maximum retries configurable with --max-retries (default: 3)
Best Practices
- Prompts: Be specific about style, lighting, composition
- Styles: Use markdown templates for consistent results
- References: Provide visual examples for style matching
- Batch: Generate variations to pick the best
- Iteration: Edit results to refine
- Retries: Increase
--max-retriesfor unreliable connections
Readme
Nano Banana Plugin
AI image generation and editing using Google Gemini 3 Pro Image API.
Version: 2.2.0 Category: media License: MIT
Features
- Text-to-Image: Generate images from text prompts
- Style Templates: Apply markdown-based style templates
- Batch Generation: Generate multiple variations at once
- Image Editing: Modify existing images with natural language
- Reference Images: Use reference images for style consistency
- Aspect Ratios: Support for 1:1, 3:4, 4:3, 9:16, 16:9, 21:9, and more
- Node.js Native: No Python required, uses Node.js (already installed for Claude Code)
Installation
-
Install the plugin via Claude Code:
/plugin marketplace add MadAppGang/claude-code -
Enable in
.claude/settings.json:{ "enabledPlugins": { "nanobanana@mag-claude-plugins": true } } -
Set up your Gemini API key:
export GEMINI_API_KEY="your-api-key"Get your API key from: https://makersuite.google.com/app/apikey
-
Install dependencies:
cd plugins/nanobanana npm install
Quick Start
Generate an Image
/nanobanana:generate "A minimal 3D cube on black background"
Create and Use a Style
# Create a style
/nanobanana:style create glass
# Describe: "3D glass material with blue tint, reflections, black background"
# Generate with style
/nanobanana:generate "gear icon" --style glass
Batch Generation
/nanobanana:generate "cube" "sphere" "pyramid" --style glass
# Creates: generated/cube_001.png, generated/cube_002.png, generated/cube_003.png
Edit an Image
/nanobanana:edit photo.jpg "Make the sky more dramatic"
With Reference Image
/nanobanana:generate "Same style but with a sphere" --ref previous_output.png
Commands
/nanobanana:generate
Generate images from text prompts.
Usage:
/nanobanana:generate "prompt" [--style name] [--aspect ratio] [--ref image]
Examples:
/nanobanana:generate "A serene mountain lake at sunset"
/nanobanana:generate "gear icon" --style glass
/nanobanana:generate "cube" "sphere" "pyramid" --style glass --aspect 1:1
/nanobanana:generate "landscape" --aspect 16:9
/nanobanana:edit
Edit existing images with natural language instructions.
Usage:
/nanobanana:edit <image> "instruction" [--ref image]
Examples:
/nanobanana:edit photo.jpg "Add dramatic sunset colors to the sky"
/nanobanana:edit logo.png "Change colors to blue and gold"
/nanobanana:edit scene.jpg "Add a rainbow" --ref rainbow_style.png
/nanobanana:style
Manage style templates.
Usage:
/nanobanana:style <action> [name]
Actions:
create- Create a new stylelist- List all available stylesshow- Display style contentsupdate- Update existing styledelete- Delete style (with confirmation)
Examples:
/nanobanana:style create watercolor
/nanobanana:style list
/nanobanana:style show glass
/nanobanana:style delete minimalist
Aspect Ratios
| Ratio | Use Case |
|---|---|
| 1:1 | Social media, icons |
| 3:4 | Portrait photos |
| 4:3 | Traditional photos |
| 4:5 | Instagram portrait |
| 5:4 | Landscape photos |
| 9:16 | Mobile wallpapers, stories |
| 16:9 | YouTube thumbnails, desktop |
| 21:9 | Ultrawide, cinematic |
Style System
Styles are simple markdown files stored in styles/ directory. The entire file content is used to enhance your prompts.
Style Template
# Style Name
{Vivid description of the visual style. Include:
- Overall aesthetic and mood
- Key visual characteristics
- Lighting and atmosphere
- Material properties if applicable}
## Color Palette
- Primary: {color} ({hex})
- Secondary: {color} ({hex})
- Background: {color} ({hex})
## Technical Notes
{Rendering style, camera angles, post-processing}
Example: Blue Glass 3D
# Blue Glass 3D Style
A photorealistic 3D render with blue glass material. Objects should have:
- Glossy, translucent blue glass surface
- Subtle reflections and refractions
- Solid black background
- Soft studio lighting from above-left
- Sharp shadows
## Color Palette
- Primary: Deep blue (#1a4b8c)
- Highlights: Light cyan (#7fdbff)
- Background: Pure black (#000000)
## Technical Notes
- Use ray-traced rendering appearance
- Include caustic light effects
- Maintain consistent material across objects
Environment Variables
| Variable | Required | Description |
|---|---|---|
GEMINI_API_KEY | Yes | Google AI API key for Gemini |
Setup:
# macOS/Linux
export GEMINI_API_KEY="your-api-key"
# Add to shell profile for persistence
echo 'export GEMINI_API_KEY="your-key"' >> ~/.zshrc
Example Workflows
Workflow 1: Icon Set with Consistent Style
# 1. Create style
/nanobanana:style create glass
# Describe: "3D glass material with blue tint"
# 2. Generate first icon
/nanobanana:generate "home icon" --style glass
# 3. Use as reference for consistency
/nanobanana:generate "settings icon" --style glass --ref generated/home_icon.png
/nanobanana:generate "user icon" --style glass --ref generated/home_icon.png
Workflow 2: Photo Enhancement
# 1. Edit photo
/nanobanana:edit landscape.jpg "Add dramatic sunset sky"
# 2. Further refinement
/nanobanana:edit landscape_edited.png "Add birds flying in the distance"
# 3. Apply artistic style
/nanobanana:edit landscape_edited.png "Make it look painted" --ref painting_style.jpg
Workflow 3: YouTube Thumbnails
# Create style for consistent branding
/nanobanana:style create youtube_thumb
# Describe: "Bold text overlay, dramatic lighting, vibrant colors"
# Generate thumbnails at 16:9
/nanobanana:generate "Tech review" "Gaming" "Tutorial" --style youtube_thumb --aspect 16:9
Error Handling
The plugin includes robust error handling:
- Automatic Retries: Transient errors (rate limits, network issues) are automatically retried with exponential backoff
- Structured Error Codes: Clear error messages with actionable recovery steps
- Partial Batch Support: If some images in a batch fail, successful ones are still saved
- Input Validation: All inputs are sanitized before execution
Security
- All user inputs are validated and sanitized
- Style files are checked for injection patterns
- Destructive operations require user confirmation
- No secrets stored in files
Troubleshooting
"GEMINI_API_KEY not set"
Set your API key:
export GEMINI_API_KEY="your-key"
"Style file not found"
List available styles:
/nanobanana:style list
Rate Limit Errors
The plugin automatically retries with exponential backoff. You can increase retry attempts:
# Via CLI: --max-retries 5
node main.js out.png "prompt" --max-retries 5
Direct CLI Usage
You can use the Node.js script directly:
# Simple generation
node plugins/nanobanana/main.js output.png "A minimal 3D cube"
# With style
node plugins/nanobanana/main.js out.png "gear" --style styles/glass.md
# Batch generation
node plugins/nanobanana/main.js out.png "cube" "sphere" "pyramid"
# Edit image
node plugins/nanobanana/main.js edited.png "Make sky blue" --edit photo.jpg
# With reference
node plugins/nanobanana/main.js out.png "prompt" --ref style.png
# Aspect ratio
node plugins/nanobanana/main.js out.png "prompt" --aspect 16:9
# Show help
node plugins/nanobanana/main.js --help
Development
Requirements
- Node.js 18+
- Google Gemini API key
Running Tests
cd plugins/nanobanana
# Install dependencies
npm install
# Test API key setup
echo $GEMINI_API_KEY
# Test simple generation
node main.js test.png "A simple red circle"
License
MIT License - see LICENSE file for details.
Author
Jack Rudenko (i@madappgang.com) MadAppGang
Support
For issues and questions:
- GitHub: https://github.com/MadAppGang/claude-code
- Email: i@madappgang.com
Changelog
v2.2.0 (2026-01-05)
Initial Release
- Node.js implementation using @google/generative-ai
- Uses Node.js (already available for Claude Code users)
- Simple CLI:
node main.js output.png "prompt" [options]
Features:
- Text-to-image generation with Gemini 3 Pro Image
- Markdown-based style system
- Batch generation with multiple prompts
- Image editing with natural language
- Reference image support
- Configurable aspect ratios
Security & Reliability:
- Input sanitization with injection detection
- Exponential backoff retry logic
- Structured error codes
- Destructive operation confirmation
Details
- Marketplace
- MadAppGang/claude-code
- Source
- plugins/nanobanana
- Author
- Jack Rudenko
- Category
- Media
- Keywords
- image-generation, ai-art, gemini, text-to-image, image-editing, style-transfer, nano-banana, google-ai
- Listed since
- Apr 6, 2026
More from MadAppGang/claude-code
All 9Similar to nanobanana
More AI Image, Video & Voice
Nano-BananaMCP serverconechoai240 starsImage generation and editing through Google's Gemini 2.5 Flash Image API, with iterative refinement.
nano-banana-proSkillintellectronica/agent-skills3.2K installsGenerates and edits images with Google's Nano Banana Pro (Gemini 3 Pro Image) API at 1K, 2K, or 4K.
image-generatorPlugindair-ai/dair-academy-plugins619 starsGenerate and edit images using Gemini's Nano Banana Pro model with text-to-image, editing, and multi-image composition
image-genPluginnicknisi/claude-plugins114 starsGenerate or edit images via Google Gemini (nano-banana-pro) or OpenAI gpt-image-2. Supports 1K/2K/4K resolution and masked inpainting.
generate-imagePluginFradSer/dotclaude596 starsGenerate or edit images via two backends: Google Gemini (gemini-3-pro-image) or any OpenAI-compatible endpoint (gpt-image-2, dall-e-3)