Nano Banana Gemini API guide cover: MODELLIX wordmark, two-line title, amber key and banana image pipeline on a dark stage

Yes — Nano Banana runs on the Gemini API, and “Nano Banana” is not one model. As of September 9, 2026, the name covers four Gemini image models, each with its own model ID: gemini-3.1-flash-lite-image (Nano Banana 2 Lite), gemini-3.1-flash-image (Nano Banana 2), gemini-3-pro-image (Nano Banana Pro), and gemini-2.5-flash-image (the original Nano Banana, on a shutdown clock). They share one base URL, one authentication scheme, and the same per-image billing model — the differences are capability, resolution, and price. This guide maps the family to the IDs, gives you the per-image cost of each model pulled from Google’s pricing page today, and walks a first request through the Interactions API in curl and Python. Every number below carries its access date; pricing on this API moves.

One disclosure before the code: this article is published by Modellix, an API aggregator that routes Google’s image models among 210+ others, and we have a commercial interest when our path appears in the last section. The entire Google-direct material is vendor-neutral and works whether or not you ever look at us.

The four Nano Banana models on the Gemini API

Google’s image-generation documentation is the naming authority, and it has been unambiguous since the Gemini 3 image models went GA: “Nano Banana” is the umbrella name for Gemini’s native image capabilities, and the umbrella currently covers four distinct models. Every tutorial that still treats Nano Banana as a single 2025-era model is describing the old lineup — one member of it is being retired.

Marketing name Model ID (Gemini API) Google’s one-line role Status
Nano Banana 2 Lite gemini-3.1-flash-lite-image Fastest and cheapest; velocity and scale first GA, no shutdown announced
Nano Banana 2 gemini-3.1-flash-image Generalist workhorse; 4K, reliable text, multi-reference GA (May 28, 2026), no shutdown announced
Nano Banana Pro gemini-3-pro-image Premium tier; brand consistency, precision control GA (May 28, 2026), no shutdown announced
Nano Banana (original) gemini-2.5-flash-image Legacy pioneer — migrate off Shutdown October 2, 2026

Two naming traps before you copy an ID from an old blog post. First, version numbers do not rank the models: Nano Banana Pro runs on Gemini 3 (gemini-3-pro-image) while the cheaper Nano Banana 2 runs on Gemini 3.1 (gemini-3.1-flash-image) — the higher-looking number is the faster generalist, not the premium tier. Second, several pages still ranking for this topic teach retired -preview IDs (gemini-3-pro-image-preview and gemini-3.1-flash-image-preview both shut down June 25, 2026); the errors section shows the exact failure mode those strings produce.

One question arrives alongside “which model”: “can I use Nano Banana in Gemini?” That is the consumer app, and it is a different product from the API this guide covers. The Gemini app and its subscriptions give you Nano Banana 2 behind a chat interface; the Gemini API gives you all four models behind generativelanguage.googleapis.com with per-image billing. Same brand, different billing surface, no shared quota.

Which Nano Banana model should you call?

The four IDs exist because the workloads genuinely differ. Table first, then the constraints that are easy to miss.

Nano Banana 2 Lite Nano Banana 2 Nano Banana Pro Nano Banana (2.5)
Model ID gemini-3.1-flash-lite-image gemini-3.1-flash-image gemini-3-pro-image gemini-2.5-flash-image
Output sizes 1K only 0.5K–4K 1K–4K ~1K
Typical latency sub-2 seconds fast slower (reasoning pass) fast
Text rendering / 4K basic strong strongest (typography-grade) basic
Search grounding not supported web + image search web search no
Reference images up to 14 objects (not its strength) up to 10 objects + 4 characters up to 6 objects + 5 characters + 3 style refs up to 3
2026-09-09 standard 1K price $0.0336 $0.067 $0.134 $0.039

Nano Banana 2 is the default for almost everything: Google positions it as the “generalist workhorse,” and it is the only member that combines 4K output with sub-$0.10 1K images, multi-reference consistency, and web-plus-image search grounding. If you are starting a new integration with no strong constraint, start here.

Nano Banana 2 Lite is the cost and velocity play. It caps at 1K output, drops search grounding, and Google says it is not optimized for multi-reference or multi-turn sequential editing — but it targets sub-2-second latency, supports the Batch API, and at $0.0336 per 1K image it is half the price of Nano Banana 2 at the same size. Choose it for high-volume drafts, avatars, stickers, and any workload where throughput per dollar beats ceiling quality.

Nano Banana Pro is for output that has to be right. Google’s framing is “premium choice for the most complex visual tasks,” and the practical differences are legible in-image text, brand-accurate layouts, character consistency across edits, and style-reference input. It costs 2× Nano Banana 2 at the same size — $0.134 vs $0.067 for a 1K image, $0.24 at 4K. Social drafts: wasted money. Client-facing marketing assets: the only member that reliably renders the typography. Our Nano Banana Pro API guide covers its parameter surface in depth.

The original Nano Banana (Gemini 2.5 Flash Image) should not be in new code. Google’s guide calls it “the legacy pioneer of the Nano Banana series,” tells customers to transition — to Nano Banana 2 Lite for the quality/speed/cost upgrade — and lists a shutdown date of October 2, 2026. If you are maintaining a live 2.5 pipeline, the migration is a model-string swap plus a regression pass; the Gemini 2.5 Flash Image API guide walks that specific change.

Nano Banana API pricing, pulled September 9, 2026

Google bills image output per token, not per image — the per-image numbers on the pricing page are the output-rate row divided by a fixed token count per size. The rates below come from Google’s Gemini API pricing page, fetched September 9, 2026:

Model Image output rate (standard) 0.5K (512px) 1K (1024px) 2K 4K
Nano Banana 2 Lite (gemini-3.1-flash-lite-image) $30 / 1M tokens $0.0336 (1,120 tok)
Nano Banana 2 (gemini-3.1-flash-image) $60 / 1M tokens $0.045 (747 tok) $0.067 (1,120 tok) $0.101 (1,680 tok) $0.151 (2,520 tok)
Nano Banana Pro (gemini-3-pro-image) $120 / 1M tokens $0.134 (1,120 tok) $0.134 (1,120 tok) $0.24 (2,000 tok)
Nano Banana original (gemini-2.5-flash-image) $30 / 1M tokens $0.039 (1,290 tok)

The token math is Google’s own footnote arithmetic, and it explains two quirks you will otherwise hit. A “1K” image is not one flat price: the same 1,120 output tokens cost $0.0336 on Lite, $0.067 on Nano Banana 2, and $0.134 on Pro, because the per-token rate differs. And resolution is billed through token count — which is why Pro charges the same $0.134 for 1K and 2K (both 1,120 tokens) but $0.24 for 4K (2,000 tokens), while Nano Banana 2 prices every step up separately.

Three billing facts from the same pull, because each contradicts something you will read elsewhere:

  • Input is billed separately at its own per-token rate — $0.50 per 1M on Nano Banana 2, $2.00 per 1M on Pro (Google quotes Pro image input at ~$0.0011 per image, a fixed 560-token count). Text-to-image input is noise; image-edit workloads with large references are not.
  • There is no free tier for image output. The pricing page marks Free Tier “Not available” on the image-model rows — the watermark-free experimentation period ended with the 2.5 preview in January 2026. A key with no billing project will not produce images.
  • The Batch API is Google’s only discount route on this family, and support varies by model — the legacy 2.5 model’s published batch rate is half its standard rate, and the priority tier exists only on Pro. Check the model’s consumption options before planning around it.

A worked example for scale: 10,000 Nano Banana 2 images at 1K is $670 on standard rates; the same volume on Nano Banana 2 Lite is $336 — a 2× spread that mostly reflects the speed tier you chose, not a negotiated discount. The Nano Banana price guide compares per-size billing across the family if you are budgeting a specific workload.

The API surface: Interactions API vs generateContent

All four models sit behind the same auth: an API key created in Google AI Studio, sent as an x-goog-api-key header (REST) or read from GEMINI_API_KEY/GOOGLE_API_KEY by the official SDKs. There is no image-specific key type and no separate Nano Banana console — the key that calls Gemini text models calls every model in this family, and the billing gate is the Google Cloud project the key belongs to.

Interactions API generateContent API
Endpoint POST /v1beta/interactions POST /v1beta/models/{model}:generateContent
Status in Google’s docs Current default for image generation Labeled “legacy,” still fully supported
Documented image models Gemini 3 family (Lite, Nano Banana 2, Pro) All models incl. the original 2.5
Multi-turn editing Native via previous_interaction_id Manual (resend the conversation)
What new code should use This Only when maintaining 2.5/legacy calls

Google’s current image-generation guide leads with the Interactions API and marks generateContent legacy, yet most tutorials — including Google’s own AI Studio quickstart — still teach the old shape. If you are building fresh, write against Interactions; if you are maintaining an existing gemini-2.5-flash-image call, keep generateContent, which is the surface that model is documented on, and plan the migration in the errors section. Both surfaces are synchronous: the image returns inside the HTTP response.

Working code: text-to-image and multi-turn editing

Text-to-image via the Interactions API — one request, one image in the response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"input": [{"type": "text", "text": "A minimalist 2D vector illustration of a banana on a deep amber background"}],
"response_format": {
"type": "image",
"mime_type": "image/png",
"aspect_ratio": "16:9",
"image_size": "1K"
}
}'

The image comes back as base64 in the response — with the official Python SDK you read it off the output_image convenience property and decode it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import base64
import os
from google import genai

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

interaction = client.interactions.create(
model="gemini-3.1-flash-image",
input="A minimalist 2D vector illustration of a banana on a deep amber background",
response_format={
"type": "image",
"aspect_ratio": "16:9",
"image_size": "1K", # 0.5K | 1K | 2K | 4K — Lite supports 1K only
},
)

with open("nano-banana-output.png", "wb") as f:
f.write(base64.b64decode(interaction.output_image.data))
Request flow of a Nano Banana Gemini API call: a prompt goes to the POST /v1beta/interactions endpoint and a base64 image returns in the response

Figure: the Interactions API call shape used by all Gemini 3 image models — synchronous prompt in, base64 image out. Concept diagram generated September 9, 2026, not a screenshot of the console.

Multi-turn editing is where the Interactions surface earns its keep. You edit by sending the interaction ID of the previous turn instead of resending the whole image, which keeps large images out of your request path on every turn after the first:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# First turn: create a graphic
first = client.interactions.create(
model="gemini-3.1-flash-image",
input="A product infographic for a banana-scented perfume, clean layout, lots of whitespace",
)

# Second turn: edit that same graphic, referencing only the ID
edited = client.interactions.create(
model="gemini-3.1-flash-image",
input="Switch the color scheme to deep amber and copper. Do not change any other element.",
previous_interaction_id=first.id,
response_format={"type": "image", "aspect_ratio": "16:9"},
)

with open("nano-banana-edited.png", "wb") as f:
f.write(base64.b64decode(edited.output_image.data))

For single-shot editing from a file instead of a conversation, send the image as an input part in the same request (base64, or the File API for anything large). Gemini 3 image models also accept mixed reference sets — up to 14 total reference images with per-model caps (Lite: 14 objects; Nano Banana 2: 10 objects + 4 character-consistency images; Pro: 6 objects + 5 characters + 3 style references). Two configuration notes: image_size accepts 0.5K / 1K / 2K / 4K and defaults to 1K, and every generated image carries a SynthID watermark.

Gemini Image API Reference

See Google's full Nano Banana image-generation reference — parameters, aspect ratios, editing, and grounding.

View Docs

Errors, rate limits, and the October 2 trap

Four failures cover almost everything this API returns, and two of them are information traps rather than code bugs:

  • 404 NOT_FOUND (model not found) — usually a stale ID. Retired strings still circulating online: gemini-2.5-flash-image-preview (shut down January 15, 2026), gemini-3.1-flash-image-preview and gemini-3-pro-image-preview (both shut down June 25, 2026), and the Imagen 4 endpoints (shut down August 17, 2026). After October 2, 2026, this error is also what every gemini-2.5-flash-image call returns.
  • 400 INVALID_ARGUMENT — a parameter the model does not accept. The classic is image_size: "4K" on Nano Banana 2 Lite (1K only) or an aspect-ratio string outside the model’s set. Input images must be png/jpeg/webp/heic/heif.
  • 429 RESOURCE_EXHAUSTED — rate limit or quota. Back off with exponential delay and retry; for bulk workloads use the Batch API rather than hammering the online endpoint.
  • Safety refusals — aggressive filtering on realistic human content and some brand prompts is a known behavior of this family; budget your prompt corpus accordingly.

The October 2 trap deserves its own callout because it is time-sensitive and Google’s own pages are not fully consistent about it. The deprecations page records gemini-2.5-flash-image — released October 2, 2025 — with a shutdown date of October 2, 2026, and its “recommended replacement” column still points at gemini-3.1-flash-image-preview, a model that was itself shut down in June. Do not follow that column. The live migration path is a string swap:

  • gemini-2.5-flash-imagegemini-3.1-flash-lite-image if cost and speed are the priority (Google’s explicit recommendation for 2.5 users), or
  • gemini-2.5-flash-imagegemini-3.1-flash-image if you need 2K/4K output, search grounding, or stronger editing.

Everything else stays: same auth, same SDK, same endpoint family. Add image_size only if you want a resolution change — leaving it off keeps ~1K output and the closest behavior parity — and re-baseline your quality checks, because outputs are not pixel-identical between generations. The change itself takes minutes; regression-testing takes longer, so the real risk is forgetting the deadline while the model still works.

Where Modellix fits: one key across the family

Everything so far has used Google’s direct API, and that path is complete on its own. The second legitimate route is an aggregator like Modellix — a Model-as-a-Service layer, not the model maker — that fronts the same Google models behind one key. Model quality is identical, because it is the same upstream model; what changes is the call contract and the bill.

The Modellix catalog names the family the way Google’s product pages do; every price below was pulled live on September 9, 2026:

Modellix route Position on the card Modellix price (2026-09-09)
google/nano-banana “The original fast creative image model” — the legacy position $0.0351 / image flat
google/nano-banana-2 Explicitly labeled Gemini 3.1 Flash Image $0.0405 (512) · $0.0603 (1K) · $0.0909 (2K) · $0.1359 (4K)
google/nano-banana-2-lite Explicitly labeled Gemini 3.1 Flash Lite Image $0.0306 / image flat
google/nano-banana-pro Explicitly labeled Gemini 3 Pro Image $0.1206 (1K/2K) · $0.2160 (4K)

Two honest caveats. First, the aggregator’s card for the original Nano Banana does not claim to run gemini-2.5-flash-image under the hood — Modellix model pages describe the product position, not the upstream Google model string, and that card’s own routing note says “default to Nano Banana 2 unless specifically requested.” Second, this is not a claim that Modellix is the cheapest route to these models — the comparison below is with Google’s published standard rates only, and both sheets move. On the day we pulled both, Modellix per-image prices sat roughly 9–10% under Google’s standard per-image equivalents for the same sizes ($0.0603 vs $0.067 for Nano Banana 2 at 1K, $0.1206 vs $0.134 for Pro) — but the billing systems are different: Google adds per-token input and text-output charges on top of the per-image equivalent, while Modellix quotes a flat per-image price with per-task cost logging in its pricing docs. Compare your real bill, not the headline.

The architectural difference that matters for your code is sync vs async. Google returns the image inside the HTTP response; Modellix media generation is an asynchronous task — you submit, get a task_id, and poll (or receive a webhook) until the result is ready:

1
2
3
4
5
6
7
curl -X POST https://api.modellix.ai/api/v1/google/nano-banana-pro/async \
-H "Authorization: Bearer $MODELLIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A glass sculpture of a banana catching amber light, studio shot",
"aspectRatio": "1:1", "imageSize": "4K"}'
# → { "code": 0, "data": { "task_id": "task-...",
# "get_result": { "url": "https://api.modellix.ai/api/v1/tasks/task-..." } } }
Two access paths to the same Nano Banana models: Google direct returns the image synchronously; an aggregator like Modellix runs a submit-poll-retrieve async task

Figure: the sync vs async contract difference between calling Google directly and routing through a unified API — same models, different call shape. Concept diagram generated September 9, 2026.

That async contract is the trade you accept for one key and one bill across many vendors: the URL changes per model (the full contract is in the Modellix REST API docs), but your auth, polling, and error handling stay the same whether the model is Nano Banana, a Kling video model, or an OpenAI image model. For teams integrating several providers — or avoiding a per-vendor Google Cloud project — that uniformity justifies the aggregator; for a Google-only pipeline it is overhead you do not need. The endpoint and parameter reference for Nano Banana 2 through the unified path is our Nano Banana 2 API guide, and the family basics are in the how to use Nano Banana walkthrough.

Run Nano Banana Models on One Key

Log in to Modellix to call Nano Banana 2 Lite, Nano Banana 2, and Pro alongside 210+ other image and video models with one API key.

Login

Frequently Asked Questions

Which model ID is Nano Banana on the Gemini API?

Nano Banana is a family of four Gemini image models: gemini-3.1-flash-lite-image (Nano Banana 2 Lite), gemini-3.1-flash-image (Nano Banana 2), gemini-3-pro-image (Nano Banana Pro), and gemini-2.5-flash-image (the original Nano Banana, shutting down October 2, 2026).

Is Nano Banana free through the Gemini API?

Not for programmatic use. As of September 9, 2026, the pricing page lists Free Tier “Not available” for image output on the image models — a billing-enabled project is required. Free experimentation lives in the consumer Gemini app, which is a separate product from the API and shares no quota or billing with it.

Nano Banana 2 vs Nano Banana Pro — which should I call?

Nano Banana 2 (gemini-3.1-flash-image) for speed and cost on most workloads at $0.067 per 1K image; Nano Banana Pro (gemini-3-pro-image) when the output must be right — legible in-image text, brand-accurate layouts, character consistency, 4K finals — at $0.134 per 1K/2K image and $0.24 at 4K. The model names carry no ranking: Pro runs on Gemini 3, Nano Banana 2 on Gemini 3.1. For the full family comparison, see our head-to-head Nano Banana vs Nano Banana 2 vs Pro comparison.

Will gemini-2.5-flash-image keep working after October 2, 2026?

No. Google’s deprecations page lists October 2, 2026 as its shutdown date; after that, requests return a model-not-found error. Migrate by swapping the model string to gemini-3.1-flash-lite-image (cost/speed priority) or gemini-3.1-flash-image (feature parity) and regression-testing your prompts.

What is the difference between the Interactions API and generateContent?

Both are synchronous Gemini API surfaces that return generated images as base64 in the response. Interactions (POST /v1beta/interactions) is Google’s current default for the Gemini 3 image family and supports native multi-turn editing via previous_interaction_id; generateContent is labeled legacy and is the documented surface for the original gemini-2.5-flash-image model.

How much does one Nano Banana image cost?

At standard rates pulled September 9, 2026: $0.0336 for a 1K image on Nano Banana 2 Lite, $0.067 (1K) on Nano Banana 2, $0.134 (1K/2K) on Nano Banana Pro, and $0.039 for the legacy original. Prices scale with output size — Nano Banana 2 ranges from $0.045 at 0.5K to $0.151 at 4K — and input tokens are billed separately.

Can I call Nano Banana through Modellix?

Yes. Modellix catalogs Google’s image family as google/nano-banana, google/nano-banana-2, google/nano-banana-2-lite, and google/nano-banana-pro, billed per image through one asynchronous submit-poll API key. Modellix is an aggregator, not the model maker; the underlying models are Google’s.


Model status and pricing reflect public Google documentation as of September 9, 2026, and change frequently — the October 2 shutdown is a deprecation schedule Google can move, and Modellix list prices are our own sheet, not Google’s. Re-validate against the official model, deprecations, and pricing pages before committing spend. This article was written by Modellix, an API aggregator with a commercial interest in the models it routes; the Gemini API integration material above is vendor-neutral. Access image and video models — including the Nano Banana family and the leading Chinese models — through a single API key at modellix.ai.