Skip to content

Tools Reference ​

generate_image ​

Create a new image from a text prompt.

typescript
generate_image({
  prompt: "A futuristic city at night with neon lights",
  model?: "gemini-nano-banana-2.1", // optional, default
  aspectRatio?: "16:9",
  imageSize?: "2K",
  thinkingLevel?: "high"
})
ParameterRequiredDescription
promptYesText description of the image to create
modelNoModel to use, see Image options
presetNoShape by use (web, phone, webconf, banner, square), see Image options
aspectRatioNoOutput shape, see Image options
imageSizeNoOutput resolution, see Image options
useGoogleSearchNoGoogle Search grounding (not on Lite), see Image options
thinkingLevelNoReasoning effort, see Image options

edit_image ​

Edit a specific image file, optionally using reference images.

typescript
edit_image({
  imagePath: "/path/to/image.png",
  prompt: "Add a rainbow in the sky",
  referenceImages?: ["/path/to/reference.jpg"],
  model?: "gemini-2.5-flash-image"
})
ParameterRequiredDescription
imagePathYesFull file path to the image to edit
promptYesText describing the modifications
referenceImagesNoArray of file paths for style transfer / guidance
modelNoModel to use, see Image options
presetNoShape by use (web, phone, webconf, banner, square), see Image options
aspectRatioNoOutput shape, see Image options
imageSizeNoOutput resolution, see Image options
useGoogleSearchNoGoogle Search grounding (not on Lite), see Image options
thinkingLevelNoReasoning effort, see Image options

continue_editing ​

Continue editing the last generated/edited image in the session.

typescript
continue_editing({
  prompt: "Make it more colorful",
  referenceImages?: ["/path/to/style.jpg"],
  model?: "gemini-2.5-flash-image"
})
ParameterRequiredDescription
promptYesText describing the modifications
referenceImagesNoArray of reference image file paths
modelNoModel to use, see Image options
presetNoShape by use (web, phone, webconf, banner, square), see Image options
aspectRatioNoOutput shape, see Image options
imageSizeNoOutput resolution, see Image options
useGoogleSearchNoGoogle Search grounding (not on Lite), see Image options
thinkingLevelNoReasoning effort, see Image options

Image options ​

Shared by generate_image, edit_image and continue_editing. All are optional; when one is omitted the server sends nothing for it and the model's own default applies. Not every model supports every value: Google's API rejects an unsupported combination with an explicit error, which the tool returns as-is.

OptionValuesNotes
modelgemini-nano-banana-2.1 (default), gemini-3-pro-image, gemini-3.1-flash-image, gemini-3.1-flash-lite-image, gemini-2.5-flash-imageSee Model Selection.
presetweb, phone, webconf, banner, squareShape by use: web = 16:9 landscape, phone = 9:16 portrait, webconf = 16:9 video-call background (Zoom, Teams), banner = 4:1 wide strip (LinkedIn banner is 1584×396, also 4:1), square = 1:1. An explicit aspectRatio wins when both are given. Size is imageSize.
aspectRatio1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, and the panoramic 1:4, 4:1, 1:8, 8:1Omitted, the model picks the shape: in testing every model returned landscape output for new images (about 16:9, e.g. 1376×768), while edits kept the source image's shape. Pass "1:1" explicitly for a square image.
imageSize512px, 1K, 2K, 4KModel default is 1K. 512px works only on gemini-3.1-flash-image; Nano Banana 2.1 rejects it. Nano Banana 2 Lite produces 1K only.
useGoogleSearchtrue / falseGrounds the image in live Google Search results (current dates, weather, events). Works on every model except gemini-3.1-flash-lite-image, which is rejected before the API is called (Google refuses it too).
thinkingLevelminimal, medium, highHow much the model reasons before drawing. high helps complex prompts (infographics, text in images, several consistent characters) but is slower; minimal is fastest and cheapest. Model default is medium on Nano Banana 2.1. gemini-3.1-flash-image and Lite accept only minimal / high; gemini-2.5-flash-image has no thinking levels.

Output format. You cannot choose it: the Gemini API does not accept an output format for these models. In testing (Nov 2026) gemini-nano-banana-2.1, gemini-3.1-flash-image, gemini-3.1-flash-lite-image and gemini-3-pro-image all returned JPEG whatever the aspect ratio, size or grounding, and only the legacy gemini-2.5-flash-image returned PNG. Saved files get the matching extension (.jpg or .png).

get_last_image_info ​

Get information about the last generated/edited image.

typescript
get_last_image_info()

No parameters.

configure_gemini_token ​

Configure your Gemini API key (saved to ~/.nano-banana-config.json).

typescript
configure_gemini_token({
  apiKey: "your-gemini-api-key"
})
ParameterRequiredDescription
apiKeyYesGemini API key from Google AI Studio

get_configuration_status ​

Check if the API key is configured and its source.

typescript
get_configuration_status()

No parameters.

Released under the MIT License.