Skip to main content

CLI for Gemini image generation

Project description

Nano Banana CLI

banana

CLI tool for generating and editing images using Google's Gemini 3 Pro and Gemini 3.1 Flash image generation models.

Installation

pip install nanobanana

Then set your API key (get one from Google AI Studio):

export GEMINI_API_KEY=your-api-key-here

Add the export to your ~/.zshrc or ~/.bashrc to persist it.

Usage

# Generate a new image
nanobanana "a cute banana wearing sunglasses"

# With options
nanobanana "a futuristic city at sunset" -a 16:9 -r 2K -o city.png

# Edit an existing image
nanobanana "add a hat and sunglasses" -e input.png -o output.png

# Use Google Search grounding for real-time info
nanobanana "visualize today's weather in Tokyo" -s

# Use Google Image Search grounding explicitly
nanobanana "A detailed painting of a Timareta butterfly" -i

# Use reference images for style or content guidance
nanobanana "a cute cat in this style" --reference style_image.png -o cat.png
nanobanana "a mix of these people" -ref person1.png person2.png

# Enable High Thinking reasoning for difficult visual generation prompts
nanobanana "A futuristic city built inside a giant glass bottle floating in space" -t high

# Fall back to Gemini 3 Pro instead of default Gemini 3.1 Flash
nanobanana "a dog flying a kite" -p

Options

Flag Description Default
-o, --output Output file path nanobanana_TIMESTAMP.png
-a, --aspect-ratio 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1 1:1
-r, --resolution 0.5K, 1K, 2K, 4K 1K
-e, --edit Edit an existing image (provide input path) -
-ref, --reference One or more reference images to guide generation -
-s, --search Use Google Search grounding -
-i, --image-search Use Google Image Search grounding -
-p, --pro Use the Gemini 3 Pro model instead of 3.1 Flash -
-t, --thinking Thinking reasoning level (minimal or high) -

Development

git clone https://github.com/YishenTu/nanobanana.git
cd nanobanana
uv sync
cp .env.example .env  # Add your GEMINI_API_KEY
uv run nanobanana "test prompt"

Global Access

For global access, add to your shell profile (~/.zshrc or ~/.bashrc):

alias nanobanana='uv run --project /path/to/nanobanana nanobanana'

Claude Code Skill

The skill is fully self-contained. Just copy and set API key!

Requirements: Python 3.12+ (pre-installed on most systems)

  1. Copy the skill folder:

    cp -r skills/nanobanana ~/.claude/skills/
    
  2. Set your API key in ~/.zshrc or ~/.bashrc:

    export GEMINI_API_KEY="your-api-key-here"
    

That's it! Claude will automatically use this skill when you ask it to generate or edit images. Python dependencies auto-install on first run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bananagen-0.2.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bananagen-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file bananagen-0.2.0.tar.gz.

File metadata

  • Download URL: bananagen-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bananagen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2197c24f62c26dfadf0d14cd2b4976b7d1c2a86b1a0cfd4267a08bc329d892d6
MD5 816c1c721b201d15b19d7dde9c6b427f
BLAKE2b-256 330b6358e257033077b79bdb2795e2162db1b6f23e0987a62b405b0e989e6d49

See more details on using hashes here.

Provenance

The following attestation bundles were made for bananagen-0.2.0.tar.gz:

Publisher: publish.yml on YishenTu/nanobanana

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bananagen-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bananagen-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bananagen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1f555b85f8b729138f580a41013c12337d37b12458248ef8a6d43d543e965a4
MD5 3845b6cbf3c121f3094ae1449ec6c400
BLAKE2b-256 ecff9c91c4c8c543ab26e24bec8ec524e9bb850d0e37fae3e3643cfa135afd15

See more details on using hashes here.

Provenance

The following attestation bundles were made for bananagen-0.2.0-py3-none-any.whl:

Publisher: publish.yml on YishenTu/nanobanana

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page