Advance Gemini icon

Advance Gemini

Interact with Google Gemini AI models

Generate Image

AI-generated

Summary

Generate text, images, or both with a selected Gemini image model, optionally using reference images and web search grounding. For each input item, return the model’s text and metadata, plus generated images as binary data or S3 URLs.

Inputs

  • Model — Choose Nano Banana (2.5 Flash Image Preview), Nano Banana Pro (3 Pro Image Preview), or 3.1 Flash Image Preview. Defaults to 3.1 Flash Image Preview.
  • Input Images — Add any number of reference images by URL or base64 data. Optionally set each image’s MIME type and a description; descriptions are prepended to the message as INPUT DEFINITIONS, with references such as [IMAGE_1]. URL images are fetched by the node.
  • Current Message — The prompt sent to Gemini. It may be left blank; when supplied, it is sent alongside any input images.
  • Response Modalities — Select Text, Image, or both; defaults to both. Image-related settings are used when IMAGE is selected.
  • Image Aspect Ratio — Choose an aspect ratio or Auto for generated images.
  • Image Resolution — For Nano Banana Pro, choose 1K, 2K, or 4K. Defaults to 1K.
  • Use Grounding Search — For Nano Banana Pro or 3.1 Flash Image Preview, optionally enable web search grounding.
  • Use Image Search — For 3.1 Flash Image Preview only, optionally enable image search grounding.
  • Upload to S3 — When image output is enabled, optionally upload generated images using the node’s S3 credentials. Defaults to off.
  • S3 Bucket Name (required) — Required when S3 upload is enabled.
  • S3 Public Domain — Optional domain used to construct returned image URLs when uploading to S3.
  • Additional Options — Optionally set temperature, maximum output tokens, top P, and top K. You can also enable parallel batch calls and set a batch size (default 5); the node returns the first completed response containing an image. Batch settings only affect calls when IMAGE output is selected.

Output shape

One n8n output item per input item, with a JSON object and, when an image is generated without S3 upload, binary image data.

JSON includes text, model, responseModalities, and usage.totalTokens (the text response length); groundingMetadata is included when returned by Gemini. Without S3 upload, JSON metadata describes the first generated image and binary.data contains that image. With S3 upload, JSON includes images with URL, fileName, and mimeType, plus imageUrl for the first image. Additional generated images are represented in JSON when uploaded to S3; without S3, only the first image is attached as binary data. Parallel batch mode adds parallelBatch metadata.

Links

Discussion