$npx -y skills add gargantuax/openskills --skill nanobananaGemini-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 su
| 1 | # Nano Banana |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | ## Workflow |
| 6 | |
| 7 | 1. Open [references/config.md](./references/config.md) to choose environment variables and override order. |
| 8 | 2. Open [references/models-and-api.md](./references/models-and-api.md) to pick the right Nano Banana tier and check model-specific constraints. |
| 9 | 3. 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`). |
| 10 | 4. Run `scripts/nanobanana.py generate` for one request or `scripts/nanobanana.py batch` for repeated variants. |
| 11 | 5. Add `--dry-run` first when the main risk is the payload shape, endpoint, or model-specific option support. |
| 12 | 6. Pass `--base-url` or `GEMINI_BASE_URL` when you need a custom Gemini-compatible gateway. |
| 13 | 7. Add `--save-response <path>` on `generate` when you need the raw JSON body for debugging. |
| 14 | |
| 15 | ## Commands |
| 16 | |
| 17 | Single text-to-image request: |
| 18 | |
| 19 | ```powershell |
| 20 | python .\skills\nanobanana\scripts\nanobanana.py generate ` |
| 21 | --prompt "A retro-futurist product hero illustration for a developer tool" ` |
| 22 | --output .\out\hero.png ` |
| 23 | --model nanobanana-2 ` |
| 24 | --ratio 16:9 ` |
| 25 | --size 2K |
| 26 | ``` |
| 27 | |
| 28 | Edit an existing image with two local references: |
| 29 | |
| 30 | ```powershell |
| 31 | python .\skills\nanobanana\scripts\nanobanana.py generate ` |
| 32 | --prompt "Turn these references into a clean launch poster with legible title text" ` |
| 33 | --input-image .\refs\subject.png ` |
| 34 | --input-image .\refs\background.png ` |
| 35 | --output .\out\poster.png ` |
| 36 | --model nanobanana-pro ` |
| 37 | --ratio 4:5 ` |
| 38 | --size 2K |
| 39 | ``` |
| 40 | |
| 41 | Use a custom Gemini-compatible gateway: |
| 42 | |
| 43 | ```powershell |
| 44 | python .\skills\nanobanana\scripts\nanobanana.py generate ` |
| 45 | --prompt "A bold mascot sticker pack" ` |
| 46 | --output .\out\stickers.png ` |
| 47 | --base-url http://your-gateway.example.com/v1beta ` |
| 48 | --auth-mode bearer |
| 49 | ``` |
| 50 | |
| 51 | Batch-generate five variants: |
| 52 | |
| 53 | ```powershell |
| 54 | python .\skills\nanobanana\scripts\nanobanana.py batch ` |
| 55 | --prompt "Minimal app icon for a PDF workflow product" ` |
| 56 | --count 5 ` |
| 57 | --dir .\out\icons ` |
| 58 | --prefix icon ` |
| 59 | --model nanobanana ` |
| 60 | --ratio 1:1 |
| 61 | ``` |
| 62 | |
| 63 | Inspect the final request without sending it: |
| 64 | |
| 65 | ```powershell |
| 66 | python .\skills\nanobanana\scripts\nanobanana.py generate ` |
| 67 | --prompt "An editorial illustration of AI agents at work" ` |
| 68 | --model nanobanana-2 ` |
| 69 | --output .\out\agents.png ` |
| 70 | --dry-run |
| 71 | ``` |
| 72 | |
| 73 | ## Rules |
| 74 | |
| 75 | - `--model` accepts the aliases `nanobanana`, `nanobanana-2`, and `nanobanana-pro`, or an exact Gemini model ID. |
| 76 | - `nanobanana` resolves to `gemini-2.5-flash-image`, `nanobanana-2` resolves to `gemini-3.1-flash-image-preview`, and `nanobanana-pro` resolves to `gemini-3-pro-image-preview`. |
| 77 | - `image_size` is only valid on Gemini 3 image models; `nanobanana` rejects `--size`. |
| 78 | - `512` resolution is only valid on `nanobanana-2`. |
| 79 | - Process environment variables override `.env`; CLI flags override both. |
| 80 | - Never print secrets. |
| 81 | - `generate` accepts repeated `--input-image` paths for image editing or multi-reference generation. |
| 82 | - `--base-url` should point to the Gemini API root such as `https://generativelanguage.googleapis.com/v1beta`, not directly to `/models/...`. |
| 83 | - `--auth-mode auto` uses `x-goog-api-key` for the official Google endpoint and sends both `Authorization: Bearer` and `x-goog-api-key` for custom endpoints to maximize gateway compatibility. |
| 84 | |
| 85 | ## Resources |
| 86 | |
| 87 | - Script: [scripts/nanobanana.py](./scripts/nanobanana.py) |
| 88 | - Config reference: [references/config.md](./references/config.md) |
| 89 | - Models and API reference: [references/models-and-api.md](./references/models-and-api.md) |