@willh/nanobanana-cli
v0.1.0
Published
CLI for Gemini Nano Banana image generation and editing workflows.
Maintainers
Readme
Nano Banana CLI
@willh/nanobanana-cli is a dependency-free Node.js CLI for Gemini Nano Banana image workflows:
- text-to-image
- image editing with references
- multi-image composition
- optional Google Search grounding
- configurable thinking, aspect ratio, and output size
The repository also contains the matching agent skill at skills/nanobanana-cli/SKILL.md.
Install
Recommended runtime:
- Node.js 22+
- npm latest
- Gemini API key in
NANOBANANA_GEMINI_API_KEYor fallbackGEMINI_API_KEY
Run without installing:
$env:NANOBANANA_GEMINI_API_KEY="YOUR_KEY"
npx @willh/nanobanana-cli --prompt "A banana astronaut in space, cinematic lighting"Install globally:
npm install --global @willh/nanobanana-cli
nanobanana --helpUsage
Basic generation:
$env:NANOBANANA_GEMINI_API_KEY="YOUR_KEY"
nanobanana --prompt "A banana astronaut in space, cinematic lighting"Generate with multiple references:
nanobanana `
--prompt "Create an ecommerce hero shot from these references" `
-i .\ref1.png -i .\ref2.jpgSpecify render controls:
nanobanana `
--prompt "Flat illustration of a weather dashboard" `
--aspect-ratio 16:9 `
--resolution 2K `
--thinking medium `
--output-mode both `
--output-dir .\outEnable Google Search grounding:
nanobanana `
--prompt "Create a visual summary of this week's weather in San Francisco" `
--google-searchUse npx directly:
npx @willh/nanobanana-cli --prompt "Minimal product poster with warm studio lighting"Generated files are saved to nanobanana-output/ by default.
CLI Options
-p, --prompt <text>: prompt text-i, --image <path>: reference image path, repeatable up to 14 images--images <p1,p2,...>: comma-separated reference image paths--model <name>: model name, defaultgemini-3.1-flash-image-previeworNANOBANANA_MODEL--thinking <level>:minimal,low,medium,high--aspect-ratio <ratio>: for example1:1,16:9,5:4,Auto--resolution <size>:512,512px,1K,2K,4K--output-mode <mode>:imagesorboth--google-search: enable Google Search grounding--output-dir <dir>: output directory--api-key <key>: overrideNANOBANANA_GEMINI_API_KEYorGEMINI_API_KEY--name-prefix <prefix>: output file prefix-h, --help: print help
Defaults
- Default model:
gemini-3.1-flash-image-preview - Model env override:
NANOBANANA_MODEL - Default thinking:
high - Default aspect ratio:
Auto - Default resolution:
1K - Default output mode:
images - Default output directory:
nanobanana-output/ - Max reference images:
14 512pxrequests are sent as string"512"to match Gemini API requirements
Publish And Release
This repo is set up for automated release management with release-please and automated npm publishing through Trusted Publishing.
One-time setup
- Create the npm package
@willh/nanobanana-cliunder the target npm org/user. - In npm package settings, add a Trusted Publisher for this GitHub repository:
- Repository:
doggy8088/nanobanana-cli - Workflow file:
.github/workflows/publish.yml - Environment: not required
- Repository:
- Ensure GitHub Actions is enabled on the repository.
Day-to-day release flow
- Merge changes into
main. Release Pleaseopens or updates a release PR based on conventional commits.- Merge the release PR.
Release Pleasecreates the GitHub Release and tag.- The
Publish to npmworkflow runs onrelease.publishedand executes:- Node.js 22
npm install --global npm@latestnpm cinpm testnpm publish --provenance --access public
Commit format
Use conventional commits so release-please can calculate version bumps:
feat: add support for google search grounding
fix: validate missing prompt before API request
docs: update trusted publishing instructionsCI
GitHub Actions includes:
CI: runs on push and pull request with Node 22, upgrades npm to latest, then runsnpm ciandnpm testRelease Please: manages release PRs, changelog updates, tags, and GitHub ReleasesPublish to npm: publishes to npm with OIDC Trusted Publishing and provenance
Repository Layout
skills/nanobanana-cli/SKILL.md: skill instructions and operating defaultsbin/nanobanana.js: publishednanobananabinary wrapperskills/nanobanana-cli/scripts/nanobanana-cli.js: main CLI implementationskills/nanobanana-cli/references/image-generation-api.md: detailed API behavior and payload rulesskills/nanobanana-cli/references/sources.md: source provenance
Local Verification
npm install --global npm@latest
npm ci
npm test
npx @willh/nanobanana-cli --help