Direct CLI invocation - no HTTP server required.
bash
# Set your API key (once)
export NANOBANANA_GEMINI_API_KEY="your_key_here"
# Generate an image
node nanobanana-plus.mjs generate --prompt "a cute cat" --filename cat.png
bash
node nanobanana-plus.mjs generate \
--prompt "一只橘猫坐在雨天窗台上" \
--filename "cat-window.png" \
--aspect-ratio "16:9"
Options:
FlagDescription--promptImage description (required)--filenameOutput file path--aspect-ratio``16:9, 9:16, 1:1, 4:3, 3:4, 21:9``--modelModel name (see below)--output-countNumber of images (1-8)
bash
node nanobanana-plus.mjs models
bash
node nanobanana-plus.mjs check
ModelDescriptiongemini-3.1-flash-image-previewNano Banana 2 (default) - fast, quota-efficientgemini-3-pro-image-previewNano Banana Pro - higher qualityimagen-4.0-ultra-generate-001Imagen 4 Ultra - best realism (requires Pro key)imagen-4.0-fast-generate-001Imagen 4 Fast - balanced speed/quality (requires Pro key)
Example with specific model:
bash
node nanobanana-plus.mjs generate \
--prompt "majestic snowy mountain, photorealistic" \
--filename mountain.png \
--model "gemini-3-pro-image-preview" \
--aspect-ratio "16:9"
The CLI uses these environment variables (set once in your shell):
bash
export NANOBANANA_GEMINI_API_KEY="your_key" # Recommended
# or
export GEMINI_API_KEY="your_key" # Fallback
edit and restore are not supported in CLI mode (use MCP server for these features)MEDIA: prefix for chat providers