
Nanobanana
Generate or edit product and marketing images from your coding agent using Gemini Nano Banana models via one Python CLI.
Overview
Nanobanana is an agent skill for the Build phase that generates and edits images through Gemini Nano Banana, Nano Banana 2, or Nano Banana Pro via a Python CLI with batching and custom endpoints.
Install
npx skills add https://github.com/gargantuax/openskills --skill nanobananaWhat is this skill?
- One Python CLI with `generate` and `batch` subcommands and zero third-party dependencies
- Three model aliases: Nano Banana, Nano Banana 2, and Nano Banana Pro with offline pre-flight validation
- Text-to-image, image-to-image edits, and multi-reference inputs with custom Gemini-compatible base URLs
- Strict validation for model-specific aspect_ratio and image_size before API calls
- Config from CLI flags, environment, or `.env` with predictable override order plus agent-friendly dry runs
- Two CLI subcommands: generate and batch
- Three model tiers with aliases: Nano Banana, Nano Banana 2, Nano Banana Pro
- Zero third-party Python dependencies
Adoption & trust: 10.2k installs on skills.sh; 2 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need consistent AI image generation and edits from the agent without ad-hoc API snippets, wrong model settings, or scattered API keys.
Who is it for?
Solo builders automating marketing assets, UI placeholders, or batched creative variants with a Gemini API key and Python 3.10+.
Skip if: Teams that only need one-off images in a browser UI with no repo automation, or builders without a Gemini-compatible generateContent endpoint and API key.
When should I use this skill?
User asks to generate or edit images with Nano Banana, Nano Banana 2, or Nano Banana Pro through a Gemini-compatible API.
What do I get? / Deliverables
Validated CLI commands produce saved image outputs (or dry-run plans) using the right Nano Banana tier, aspect ratio, and image size for your Gemini endpoint.
- Generated or edited image files from CLI runs
- Batch job outputs with validated model-specific dimensions
- Dry-run validation output before live API calls
Recommended Skills
Journey fit
Image asset creation and API wiring happen while building the product, not during launch analytics or production incident response. The skill is an external Gemini generateContent integration with env-based auth—classic build-phase third-party hookup work.
How it compares
Agent-packaged Gemini image CLI with offline validation—not a hosted design SaaS or a generic REST MCP server.
Common Questions / FAQ
Who is nanobanana for?
Indie developers and agent users who want Gemini Nano Banana generation, editing, and batch runs from the terminal inside their normal coding workflow.
When should I use nanobanana?
During Build integrations when you need text-to-image, image-to-image edits, or multi-reference inputs; also when prototyping landing visuals in Validate before committing to a design system.
Is nanobanana safe to install?
It calls external Gemini APIs with your key and writes image files locally—review the Security Audits panel on this page and keep secrets in `.env`, not in chat logs.
SKILL.md
READMESKILL.md - Nanobanana
interface: display_name: "Nano Banana" short_description: "Gemini-native Nano Banana skill for generation, editing, batching, and custom endpoints." default_prompt: "Use $nanobanana to generate or edit images with Nano Banana, Nano Banana 2, or Nano Banana Pro through a Gemini-compatible API." # nanobanana An agent skill for Gemini-native **Nano Banana** image generation and editing, covering the current three-tier lineup: - **Nano Banana**: `gemini-2.5-flash-image` - **Nano Banana 2**: `gemini-3.1-flash-image-preview` - **Nano Banana Pro**: `gemini-3-pro-image-preview` Built in the same style as this repository's `gpt-image-2` skill: one Python CLI, offline validation, `.env` support, and agent-friendly dry runs. ## Features - One CLI with two subcommands: `generate` and `batch`. - Text-to-image, image-to-image edits, and multi-reference image inputs. - Custom Gemini-compatible base URL support for self-hosted or gateway deployments. - Model aliases for `nanobanana`, `nanobanana-2`, and `nanobanana-pro`. - Strict pre-flight validation for model-specific `aspect_ratio` and `image_size` support. - Config via CLI flags, process environment, or `.env`, with a predictable override order. - Zero third-party dependencies. ## Requirements - Python 3.10+ - A Gemini-compatible `generateContent` endpoint - `GEMINI_API_KEY` ## Install After publishing the repository, the recommended install path is through [Skills](https://skills.sh/): ```powershell pnpm dlx skills add https://github.com/GargantuaX/openskills --skill nanobanana ``` Equivalent shorthand: ```powershell pnpm dlx skills add GargantuaX/openskills@nanobanana ``` If you want the whole collection instead, install: ```powershell pnpm dlx skills add GargantuaX/openskills ``` You can also clone or copy the folder and run the script directly. Register with Codex by pointing at [agents/openai.yaml](./agents/openai.yaml). Skill-aware agents can consume [SKILL.md](./SKILL.md) directly. ## Setup After skills.sh Install 1. Set credentials with environment variables, or create a `.env` in the working directory where you will run the script. 2. Start from the repository example [`.env.example`](../../.env.example), then adjust the Nano Banana section for your endpoint and model defaults. 3. Run a `--dry-run` command first to confirm the final request shape before making live API calls. Minimal `.env`: ```dotenv GEMINI_API_KEY=your-gemini-api-key GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta GEMINI_MODEL=nanobanana-2 GEMINI_TIMEOUT=300 GEMINI_ASPECT_RATIO=16:9 GEMINI_IMAGE_SIZE=2K ``` Dry-run check: ```powershell python .\scripts\nanobanana.py generate ` --prompt "A launch poster for an AI developer tool" ` --output .\out\poster.png ` --dry-run ``` ## Quick Start ```powershell # 1. Configure credentials $env:GEMINI_API_KEY = "..." $env:GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta" # 2. Generate python .\scripts\nanobanana.py generate ` --prompt "A bold product hero image" ` --output .\out\hero.png ` --model nanobanana-2 ` --ratio 16:9 ` --size 2K ``` If you run against a custom gateway, point `GEMINI_BASE_URL` at a Gemini-compatible root such as `http://your-gateway.example.com/v1beta`. If the gateway expects bearer auth instead of `x-goog-api-key`, set `GEMINI_AUTH_MODE=bearer`. ## Project Layout ```text nanobanana/ ├─ SKILL.md ├─ README.md ├─ agents/ │ └─ openai.yaml ├─ references/ │ ├─ config.md │ └─ models-and-api.md ├─ scripts/ │ └─ nanobanana.py └─ tests/ └─ test_nanobanana.py ``` ## Tests Run the offline regression tests with: ```powershell python -m unittest discover -s .\skills\nanobanana\tests -p "test_*.py" ``` ## License MIT. See the repository root [LICENSE](../../LICENSE). # Config Environment variables consumed by `scripts/nanobanana.py`: | Variable | Required | Default | Purpose | | --- | --- | --- | --- | | `GEMINI_API_KEY` | yes | none | API key for the Gemini-comp