Gemini 3.1 Flash Image (Nano Banana 2) API

Native 2K output, lightning-fast generation, and dramatically improved text rendering.

Modalities
Text, ImageImage
In / Out price
$0.25/$60per 1M
Context window
128K tokens
Released
Jun 18, 2026

Gemini 3.1 Flash Image (Nano Banana 2) overview

Gemini 3.1 Flash Image (Nano Banana 2) specs

Model ID
google/gemini-3.1-flash-image
Developer
Google
Context window
131,072 tokens
Max output
32,768 tokens
Input
Text, Image
Output
Image
API
OpenAI-compatible, base URL https://api.aimlapi.com/v1

What Is the Gemini 3.1 Flash Image API (Nano Banana 2)?

Gemini 3.1 Flash Image, nicknamed Nano Banana 2, is Google DeepMind's latest generation AI image model built on the Gemini 3.1 Flash architecture. It is not simply a minor update to its predecessor. Nano Banana 2 is a ground-up rethinking of what a fast image model can deliver, closing the quality gap between the Flash and Pro tiers in measurable, practical ways.

Where the original Nano Banana established the concept and Nano Banana Pro pushed quality to its ceiling (at the cost of speed), Nano Banana 2 occupies a strategically important middle ground: it generates at native 2K resolution, produces legible multilingual text inside images, handles multi-character spatial scenes with physically coherent anatomy and lighting, and it does all of this faster and cheaper than Pro.

In several spatial reasoning benchmarks, Nano Banana 2 outperforms the flagship Pro model, making it the smarter default for volume-driven production workflows.

Where Does Nano Banana 2 Fit in the Lineup?

The three-tier Nano Banana family maps cleanly to different production needs. Here's how they differ in practice:

Model Best for Resolution Speed tier Cost
Nano Banana Fast drafting, prototypes Standard Fastest Lowest
Nano Banana 2 ✦ Production volume, text in images, pipelines Native 2K Flash Mid-tier
Nano Banana Pro Maximum photorealism, premium editorial High Slower Higher

Key Features of Gemini 3.1 Flash Image

Nano Banana 2 advances on three fronts that have historically been the weak points of fast image models: text rendering, style fidelity, and spatial coherence. Here's what that means for your builds.

Improved Text Rendering

Legible, stable typography inside generated images, across Latin, CJK, and other scripts. Posters, ad banners, and packaging mockups come out production-ready without manual Photoshop touchups.

High-Fidelity Style Transfer

Feed the model a visual reference and it accurately inherits the color palette, texture language, and compositional grammar across new generations. Essential for brand-consistent content at scale.

Strong Spatial Reasoning

Multi-character scenes with physically plausible anatomy, correct shadows, accurate reflections, and realistic lighting. Nano Banana 2 beats Nano Banana Pro in several spatial coherence benchmarks.

Use cases

Google documents Nano Banana 2 as suitable for creating infographics and turning notes into diagrams, using its real-world knowledge and web-search grounding to render specific subjects more accurately. It is also documented for rendering legible text directly into images, including greeting cards, marketing mockups, posters, and other text-heavy layouts.

Google also describes it as useful for high-volume developer image-generation workflows because it is optimized for speed and low latency. In addition, the model is positioned for image understanding and generation with image editing, including multi-turn editing and image generation from video input.

Capabilities

  • Function calling
  • Reasoning
  • Streaming
  • Structured outputs
  • Web search

Gemini 3.1 Flash Image (Nano Banana 2) API pricing

Gemini 3.1 Flash Image (Nano Banana 2) pricing in US dollars
UsagePriceUnit
Input$0.251M tokens
Output$601M tokens

Prices from the AI/ML API price list, checked on Nov 4, 2026.

Gemini 3.1 Flash Image (Nano Banana 2) vs other models: token prices

AI/ML API input and output rates for 5 models, per million tokens.

AI/ML API model prices in USD per million tokens
ModelInputOutput
Gemini 3.1 Flash Image (Nano Banana 2)$0.25$60
Gemini 3.5 Flash Lite$0.3$2.5
Gemini 3.8 Flash$0.75$3.75
Gemini 3.7 Flash$0.75$3.75
Gemini 4 Argon$2$10

How to use the Gemini 3.1 Flash Image (Nano Banana 2) API

View docs

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemini-3.1-flash-image",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

Gemini 3.1 Flash Image (Nano Banana 2) FAQ

What is the context window of Gemini 3.1 Flash Image (Nano Banana 2)?

Gemini 3.1 Flash Image (Nano Banana 2) has a 131,072 tokens context window and can return up to 32,768 tokens.

What inputs and outputs does Gemini 3.1 Flash Image (Nano Banana 2) support?

Gemini 3.1 Flash Image (Nano Banana 2) takes image, text as input and returns text.

What is the model ID for Gemini 3.1 Flash Image (Nano Banana 2)?

Use google/gemini-3.1-flash-image as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.

How much does Gemini 3.1 Flash Image (Nano Banana 2) cost?

Gemini 3.1 Flash Image (Nano Banana 2) costs $0.25 input and $60 output per 1M tokens on AI/ML API, billed as you go with no subscription.

Does Gemini 3.1 Flash Image (Nano Banana 2) support streaming?

Yes, Gemini 3.1 Flash Image (Nano Banana 2) can stream responses as they are generated.

Can Gemini 3.1 Flash Image (Nano Banana 2) read images?

Yes, Gemini 3.1 Flash Image (Nano Banana 2) accepts image input alongside text.

Who created Gemini 3.1 Flash Image (Nano Banana 2)?

Gemini 3.1 Flash Image (Nano Banana 2) was built by Google.

What does Gemini 3.1 Flash Image (Nano Banana 2) generate?

It is a text-to-image model built for fast image generation from text prompts.

Can Gemini 3.1 Flash Image (Nano Banana 2) use web search?

Yes, it lists web search as one of its supported features.

Does Gemini 3.1 Flash Image (Nano Banana 2) support function calling and tool use?

Yes, it supports function calling along with parallel tool calls and structured outputs.

Start building with Gemini 3.1 Flash Image (Nano Banana 2)

Gemini 3.1 Flash Image (Nano Banana 2) API

google/gemini-3.1-flash-image

Build with your agent

Give your agent the model details, code and documentation.

1Get your API key

Create API key
export AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"

2Make your first request

curl 'https://api.aimlapi.com/v1/chat/completions' \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "google/gemini-3.1-flash-image",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'