Developer guide, checked October 2026
Nano Banana API: How to Get a Key, Pricing and Examples
Model IDs, prices per image, a working Python example, and the no-code option.
The Nano Banana API is Google’s Gemini API: every Nano Banana model is a Gemini image model with its own ID. You create a key in Google AI Studio, enable billing, and send a prompt (and optionally images) to the model you want. This guide lists the current IDs and prices and shows a minimal Python call.
Short answer
Create an API key in Google AI Studio, enable billing on its Google Cloud project (image models have no free tier), then call a model such as gemini-3.1-flash-image (Nano Banana 2) or gemini-3-pro-image (Nano Banana Pro). Prices run from $0.0336 to $0.24 per image depending on the model and resolution.
Nano Banana model IDs and prices
| Name | Model ID | Sizes | Standard price per image | Status |
|---|---|---|---|---|
| Nano Banana 2.1 | gemini-nano-banana-2.1 | 1K, 2K, 4K | $0.0336, $0.0504, $0.113 | Newest, October 2026 |
| Nano Banana 2 | gemini-3.1-flash-image | 512 px, 1K, 2K, 4K | $0.045, $0.067, $0.101, $0.151 | Generally available |
| Nano Banana 2 Lite | gemini-3.1-flash-lite-image | 1K | $0.0336 | Generally available |
| Nano Banana Pro | gemini-3-pro-image | 1K, 2K, 4K | $0.134, $0.134, $0.24 | Generally available |
| Nano Banana | gemini-2.5-flash-image | about 1K | $0.039 | Deprecated |
Prices are from Google’s Gemini API pricing page and drop by half in batch mode. The preview ID gemini-3.1-flash-image-preview was shut down on June 25, 2026, and Google lists March 15, 2027 as the earliest shutdown date for gemini-2.5-flash-image, so new code should use the IDs above. Imagen models are no longer available in the Gemini API.
How to get a Nano Banana API key
- 1
Open Google AI Studio
Go to aistudio.google.com and sign in with your Google account.
- 2
Create a key
Choose Get API key, then create a key in a new or existing Google Cloud project.
- 3
Turn on billing
Link a billing account to that project. Image models are not on the free tier, so calls fail without it.
- 4
Store the key safely
Save it as the GEMINI_API_KEY environment variable on your server. Never put it in front-end code.
Python example
This is Google’s minimal text-to-image call with the google-genai SDK. Set GEMINI_API_KEY in your environment first.
# pip install google-genai
from google import genai
import base64
client = genai.Client() # reads GEMINI_API_KEY
interaction = client.interactions.create(
model="gemini-nano-banana-2.1",
input="A glossy yellow banana-shaped perfume bottle on white marble, studio light",
)
with open("generated_image.png", "wb") as f:
f.write(base64.b64decode(interaction.output_image.data))
Swap the model ID for any row in the table. Google’s image generation docs show image editing, multi-image references, aspect ratios and the JavaScript, Go and REST versions.
How Nano Banana API pricing works
- You pay per output image. The price depends on the model and the resolution, as in the table.
- Inputs cost a little extra. Your prompt and any reference images are billed as input tokens, usually a small part of the total.
- Batch mode halves the price if you can wait for results instead of getting them right away.
- There is no free tier for image models. Google’s pricing page marks them as not available on the free tier, so billing must be on before the first image.
The cheapest current options are Nano Banana 2 Lite and Nano Banana 2.1 at $0.0336 per 1K image. Pro at 4K is the most expensive at $0.24.
Rate limits
Limits are set per project in requests per minute and per day, and they rise as your account moves up Google’s usage tiers. Daily limits reset at midnight Pacific time. Check the rate limit page in Google AI Studio for your current numbers before running large batches.
Other ways to call Nano Banana
- Vertex AI on Google Cloud offers the same models for companies that need Google Cloud contracts, regions and quotas.
- API gateways such as OpenRouter, fal, Replicate and the Vercel AI Gateway resell access with their own keys and prices. They are handy if you already use them for other models, but compare their per-image price with Google’s list price.
Using Nano Banana without code
If you need images rather than an integration, you can skip keys and billing setup. Nano Banana AI runs Nano Banana, Nano Banana 2 Lite, Nano Banana 2 and Nano Banana Pro in the browser on one credit balance, next to models like GPT Image 2. Nano Banana AI does not offer a public API.
Frequently asked questions
Is the Nano Banana API free?
No. Google’s Gemini API pricing page lists image models as not available on the free tier, so you need billing enabled. Prices start at $0.0336 per image.
How much does the Nano Banana API cost per image?
From $0.0336 (Nano Banana 2 Lite and 2.1 at 1K) to $0.24 (Nano Banana Pro at 4K). Nano Banana 2 costs $0.067 at 1K and Nano Banana Pro $0.134 at 1K or 2K. Batch mode halves these prices.
What is the Nano Banana Pro model name in the API?
gemini-3-pro-image. Nano Banana 2 is gemini-3.1-flash-image, Nano Banana 2 Lite is gemini-3.1-flash-lite-image and Nano Banana 2.1 is gemini-nano-banana-2.1.
Where do I get a Nano Banana API key?
In Google AI Studio at aistudio.google.com: choose Get API key, create a key in a Google Cloud project and enable billing on that project.
Does Nano Banana AI have an API?
No. Nano Banana AI is a browser studio. For programmatic access, use Google’s Gemini API directly with the model IDs above.