nanobanana
gargantuax/openskills
Gemini-native Nano Banana image generation and editing with batch support and custom endpoints.
What is nanobanana?
A Python tool for text-to-image and image-to-image generation using Gemini's Nano Banana models (standard, 2, and Pro tiers). Use it when you need flexible model selection, batch variant generation, local image references, dry-run inspection, or integration with custom Gemini-compatible gateways.
- Generate images from text prompts across three Nano Banana model tiers
- Edit existing images with multiple local image references
- Batch-generate variants with configurable count, naming, and output directory
- Inspect request payloads with dry-run mode before sending
- Route requests through custom Gemini-compatible endpoints or self-hosted gateways
- Validate options strictly per model and tier constraints
How to install nanobanana
npx skills add https://github.com/gargantuax/openskills --skill nanobanana- Python 3.7 or later
- Google API key (GOOGLE_API_KEY environment variable) or custom endpoint credentials
- Gemini API access for the chosen model tier
How to use nanobanana
- 1.Review references/config.md to understand environment variable and CLI flag override order
- 2.Check references/models-and-api.md to select the appropriate Nano Banana tier and verify model constraints
- 3.Run `python scripts/nanobanana.py generate --prompt "<text>" --output <path> --model nanobanana-2` for a single image
- 4.Use `--input-image <path>` (repeatable) to provide reference images for editing or multi-reference generation
- 5.Run `python scripts/nanobanana.py batch --prompt "<text>" --count <n> --dir <path> --model nanobanana-2` to generate multiple variants
- 6.Add `--dry-run` to inspect the request payload before sending
- 7.Pass `--base-url <url>` or set GEMINI_BASE_URL to route through a custom gateway
Use cases
- Create product hero illustrations, launch posters, and marketing assets from text descriptions
- Refine images by providing reference images and editing prompts
- Generate multiple icon or sticker variants for design systems
- Test image generation workflows without consuming API quota using dry-run mode
- Integrate with self-hosted or private Gemini-compatible API gateways
- Developers building image generation into applications
- Designers prototyping visual assets programmatically
- Teams using private or custom Gemini API endpoints
- Agents requiring batch image generation workflows
nanobanana FAQ
Use nanobanana-2 (gemini-3.1-flash-image-preview) by default for best balance. Use nanobanana (gemini-2.5-flash-image) for fastest/lowest-cost, or nanobanana-pro (gemini-3-pro-image-preview) for highest-fidelity reasoning.
Yes, pass `--input-image <path>` multiple times. The skill accepts repeated local image references for editing or multi-reference generation.
It inspects the final request payload without sending it to the API, useful for validating prompt shape, endpoint configuration, and model-specific option support.
Yes, pass `--base-url <url>` (e.g., http://your-gateway.example.com/v1beta) or set GEMINI_BASE_URL. Use --auth-mode bearer or auto for custom endpoints.
image_size is only valid on Gemini 3 models (nanobanana-pro); nanobanana rejects --size. 512 resolution is only valid on nanobanana-2.
Full instructions (SKILL.md)
Source of truth, from gargantuax/openskills.
name: nanobanana description: Gemini-native Nano Banana image generation and editing across Nano Banana, Nano Banana 2, and Nano Banana Pro. Use when you need text-to-image, image-to-image edits, repeated local references, batch generation, dry-run request inspection, or a custom Gemini-compatible base URL such as a self-hosted gateway.
Nano Banana
A single Python entrypoint for Gemini-native Nano Banana image generation and editing, with model aliases, strict option validation, batch runs, and custom endpoint support.
Workflow
- Open references/config.md to choose environment variables and override order.
- Open references/models-and-api.md to pick the right Nano Banana tier and check model-specific constraints.
- Prefer
gemini-3.1-flash-image-preview(nanobanana-2) unless you need either the fastest low-cost default (nanobanana) or the highest-fidelity reasoning model (nanobanana-pro). - Run
scripts/nanobanana.py generatefor one request orscripts/nanobanana.py batchfor repeated variants. - Add
--dry-runfirst when the main risk is the payload shape, endpoint, or model-specific option support. - Pass
--base-urlorGEMINI_BASE_URLwhen you need a custom Gemini-compatible gateway. - Add
--save-response <path>ongeneratewhen you need the raw JSON body for debugging.
Commands
Single text-to-image request:
python .\skills\nanobanana\scripts\nanobanana.py generate `
--prompt "A retro-futurist product hero illustration for a developer tool" `
--output .\out\hero.png `
--model nanobanana-2 `
--ratio 16:9 `
--size 2K
Edit an existing image with two local references:
python .\skills\nanobanana\scripts\nanobanana.py generate `
--prompt "Turn these references into a clean launch poster with legible title text" `
--input-image .\refs\subject.png `
--input-image .\refs\background.png `
--output .\out\poster.png `
--model nanobanana-pro `
--ratio 4:5 `
--size 2K
Use a custom Gemini-compatible gateway:
python .\skills\nanobanana\scripts\nanobanana.py generate `
--prompt "A bold mascot sticker pack" `
--output .\out\stickers.png `
--base-url http://your-gateway.example.com/v1beta `
--auth-mode bearer
Batch-generate five variants:
python .\skills\nanobanana\scripts\nanobanana.py batch `
--prompt "Minimal app icon for a PDF workflow product" `
--count 5 `
--dir .\out\icons `
--prefix icon `
--model nanobanana `
--ratio 1:1
Inspect the final request without sending it:
python .\skills\nanobanana\scripts\nanobanana.py generate `
--prompt "An editorial illustration of AI agents at work" `
--model nanobanana-2 `
--output .\out\agents.png `
--dry-run
Rules
--modelaccepts the aliasesnanobanana,nanobanana-2, andnanobanana-pro, or an exact Gemini model ID.nanobananaresolves togemini-2.5-flash-image,nanobanana-2resolves togemini-3.1-flash-image-preview, andnanobanana-proresolves togemini-3-pro-image-preview.image_sizeis only valid on Gemini 3 image models;nanobananarejects--size.512resolution is only valid onnanobanana-2.- Process environment variables override
.env; CLI flags override both. - Never print secrets.
generateaccepts repeated--input-imagepaths for image editing or multi-reference generation.--base-urlshould point to the Gemini API root such ashttps://generativelanguage.googleapis.com/v1beta, not directly to/models/....--auth-mode autousesx-goog-api-keyfor the official Google endpoint and sends bothAuthorization: Bearerandx-goog-api-keyfor custom endpoints to maximize gateway compatibility.
Resources
- Script: scripts/nanobanana.py
- Config reference: references/config.md
- Models and API reference: references/models-and-api.md
Related skills
More from gargantuax/openskills and the wider catalog.