Nano Banana 2 API

google/gemini-3.1-flash-image-preview
Nano Banana 2 is a compact text-to-image model from Google optimized for fast image generation.
Context
128K tokens
Input
$0.25 / 1M tokens
Output
$60 / 1M tokens
Released
Feb 27, 2026

Overview

What is Nano Banana 2 API?

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

Technical Specifications
- Supported inputs: Image, Text
- Output: Image
- Endpoint: /images/generations

Performance Benchmarks
[embed]

Nano Banana 2 API Pricing
- Input: $0.325 / 1M tokens
- Output: $1.95 / 1M tokens
- Output images: $78 / 1M tokens

Where to Use Nano Banana 2

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.

Code Sample
[embed]

Uptime and performance

  • Uptime (24h): 67.0%
  • Uptime (7d): 94.0%
  • Availability (24h): 96.0%
  • Error rate (24h): 4.0%

Measured on the AI/ML API gateway across live traffic. Figures are medians unless stated. Last updated 2026-10-12.

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.

How to use Nano Banana 2 API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to google/gemini-3.1-flash-image-preview.
import requests

r = requests.post(
    "https://api.aimlapi.com/v1/images/generations",
    headers={"Authorization": "Bearer " + AIMLAPI_KEY},
    json={
      "model": "google/gemini-3.1-flash-image-preview",
      "prompt": "A cat holding a sign that says hello"
    },
)
print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/images/generations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "google/gemini-3.1-flash-image-preview",
    "prompt": "A cat holding a sign that says hello"
  }),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/images/generations \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"google/gemini-3.1-flash-image-preview","prompt":"A cat holding a sign that says hello"}'

OpenAI-compatible — swap the base URL and it works with your existing SDK.

Nano Banana 2 API Pricing

TypePrice
Input
$0.25 / 1M tokens
Output
$60 / 1M tokens

Text input $0.325/1M · reasoning $1.95/1M · image output $78/1M. Free credits on signup.

Nano Banana 2 Benchmarks

BenchmarkScoreWhat it measuresSourceRetrieved
Text-to-Image Arena
1123
Human preference Elo from blind pairwise comparisons of generated images, measured independently by Artificial AnalysisSourceSeptember 28, 2026

Nano Banana 2 vs other models

ModelInputOutputContextBest for
Nano Banana 2
This page
$0.25 / 1M tokens
$60 / 1M tokens
128K tokens
Image generation at scale
$5 / 1M tokens
$30 / 1M tokens
Image generation at scale
$0.25 / gen
Image generation at scale
$0.015 / MP (variable)
Image generation at scale

Frequently asked questions

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

Nano Banana 2 became available on February 27, 2026.

Nano Banana 2 is priced at input $0.325 / 1M tokens, output $78 / 1M tokens.

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

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

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

Nano Banana 2 was built by Google.

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

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

Start building with Nano Banana 2

Get API Key
1000+ models, one API.