Nano Banana 2 (Gemini 3.1 Flash Image)

circle-info

This documentation is valid for the following list of our models:

  • google/nano-banana-2

  • google/gemini-3-1-flash-image-preview

circle-check

Model Overview

A fast image generation model from Google DeepMind, optimized for low-latency and high-throughput text-to-image workflows. Ideal for interactive apps and real-time image generation.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guidearrow-up-right.

API Schema

post
Body
modelstring · enumRequiredPossible values:
promptstringRequired

The text prompt describing the content, style, or composition of the image to be generated.

image_urlsstring · uri[] · max: 5Optional

List of URLs or local Base64 encoded images to edit.

aspect_ratiostring · enumOptional

The aspect ratio of the generated image.

Default: 1:1Possible values:
resolutionstring · enumOptional

The resolution of the output image.

Default: 1KPossible values:
enable_web_searchbooleanOptional

Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image.

Default: false
Responses
chevron-right
200Success
application/json
post
/v1/images/generations
200Success

Quick Example #1: Prompt Only

Let's generate an image of the specified size using a simple prompt.

chevron-rightResponsehashtag

We obtained the following 1376x768 image by running this code example:

"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses."

Quick Example #2: Reference Images

Generate an image with the specified quality and aspect ratio using two input images and a prompt that defines how the images should be edited.

chevron-rightResponsehashtag
Reference Images
Generated Image
Image #1
"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect."
Image #2

Here’s an example of the output using alternative resolution and aspect_ratio parameters:

"aspect_ratio": "16:9", "resolution": "2K"

Last updated

Was this helpful?