Edit / compose image (Nano Banana)
edit_imageEdit, inpaint, restyle, or compose up to 14 reference images with Gemini Nano Banana models; auto-picks Nano Banana 2 or Pro by prompt complexity.
Instructions
Edit, inpaint, restyle, or compose one or more reference images using Gemini's Nano Banana models. Accepts local file paths or inline base64 image data. By default, automatically picks Nano Banana 2 or Nano Banana Pro based on prompt complexity and reference-image count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model id or alias. "auto" (default) smart-selects between Nano Banana 2 and Nano Banana Pro based on prompt complexity. Known aliases: nb2/nano-banana-2 (gemini-3.1-flash-image), pro/nano-banana-pro (gemini-3-pro-image), legacy/nano-banana (gemini-2.5-flash-image, not auto-selected). Any other Gemini image-capable model id is accepted and passed through as-is. | |
| images | Yes | 1-14 reference images, each as either a local file path or inline base64 data. Order matters when the prompt refers to "the first image" / "the second image". | |
| prompt | Yes | Editing instructions: what to add, remove, or change, or how to combine the provided image(s). Describe the desired result, not the mechanics of the edit. | |
| image_size | No | "4K" only on Nano Banana 2 / Nano Banana Pro. Defaults to 1K. | |
| output_path | No | File path or directory to save the image to. Relative paths resolve against NANOBANANA_OUTPUT_DIR (or the system temp dir if unset), not the current working directory. | |
| aspect_ratio | No | Aspect ratio of the output image. Defaults to the model's default (usually 1:1) when omitted. | |
| save_to_file | No | Also write the generated image(s) to disk (and make them browsable via the generated-image:// resource). Defaults to true when NANOBANANA_OUTPUT_DIR is set, false otherwise. | |
| thinking_level | No | "high" improves complex prompts at the cost of latency. Only affects Nano Banana 2 (ignored otherwise). | |
| person_generation | No | Controls generation of people in the image. | |
| use_search_grounding | No | Ground the image in real-time Google Search results (e.g. current weather, sports scores, recent events). Not supported on the legacy model. |