Nano Banana 2 API

Nano Banana 2 is a compact text-to-image model from Google optimized for fast image generation.

Modalities
Image, TextImage
In / Out price
$0.25/$60per 1M
Context window
128K tokens
Released
Feb 26, 2026

Nano Banana 2 overview

Nano Banana 2 specs

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

Nano Banana 2 is a compact text-to-image model from Google optimized for fast image generation.

High-volume image generation
Produce product visuals, thumbnails, and marketing assets programmatically at scale.

Creative and concept art
Turn text prompts into illustrations, mockups, and design explorations.

Image editing and variations
Provide a reference image to guide edits, restyles, or variations.

Use cases

Nano Banana 2 is documented as suited for text-to-image generation, including creating images from prompts with strong image understanding and generation capabilities.

It is also suited for image-guided editing and iterative image refinement, including multi-turn workflows where a user can keep adjusting the result across turns.

The model is documented for creating clear text-heavy visuals such as posters, marketing mockups, and diagrams.

It is also suited to producing more accurate grounded imagery, including infographics and historically or factually informed scenes.

Capabilities

  • Reasoning
  • Image editing
  • Vision

Nano Banana 2 API pricing

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.

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
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 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-preview",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'

Related articles

All posts

Nano Banana 2 FAQ

What inputs and outputs does Nano Banana 2 support?

Nano Banana 2 takes image, text as input and returns image.

When was Nano Banana 2 released?

Nano Banana 2 became available on February 27, 2026.

How much does Nano Banana 2 cost?

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

How is Nano Banana 2 billed?

Nano Banana 2 is billed per token, charged separately for input and output.

Can Nano Banana 2 edit an existing image?

Yes, Nano Banana 2 supports image editing as well as generation.

Can Nano Banana 2 take an existing image as input?

Yes, Nano Banana 2 accepts image input as well as a text prompt.

Who created Nano Banana 2?

Nano Banana 2 was built by Google.

How do I call Nano Banana 2 on AI/ML API?

Send a request to https://api.aimlapi.com/v1/images/generations with google/gemini-3.1-flash-image-preview as the model id.

Is Nano Banana 2 available through a single API key?

Yes. Nano Banana 2 is served through AI/ML API, so the same key and endpoint format used for other models applies.

What is the Nano Banana 2 model ID?

Use google/gemini-3.1-flash-image-preview as the model parameter. Requests go to the OpenAI-compatible endpoint with your AI/ML API key.

Start building with Nano Banana 2

Nano Banana 2 API

google/gemini-3.1-flash-image-preview

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-preview",
  "messages": [
    {
      "role": "user",
      "content": "Write a haiku about the ocean."
    }
  ]
}'