Guides
Nano Banana API Pricing, Keys, and Model IDs
The Nano Banana API is Google's Gemini API. What each model id costs, where the API key comes from, and how to call it from an agent, CLI, or MCP server.
There is no such thing as a Nano Banana API in the sense most search results imply. The Nano Banana API is the Gemini API, Nano Banana is Google's nickname for its Gemini image models, and you call them by model id like any other Gemini model. Most of the pages selling you a "Nano Banana API key" are resellers proxying that same endpoint with a margin on top.
What follows: the current model ids and what each one costs per image, where the key actually comes from, the call shape in code, and how to reach the same models from an MCP server, a CLI, or an agent when you would rather not write the plumbing.
The Nano Banana model ids
Three current models carry the name, plus one legacy id you will still see in older code. These are the strings you pass as model.
| Name | Model id | Native resolutions |
|---|---|---|
| Nano Banana 2 Lite | gemini-3.1-flash-lite-image | 1K |
| Nano Banana 2 | gemini-3.1-flash-image | 512px, 1K, 2K, 4K |
| Nano Banana Pro | gemini-3-pro-image | 1K, 2K, 4K |
| Nano Banana (legacy) | gemini-2.5-flash-image | 1K |
One detail that trips up code written against older tutorials: Google's current image samples use the Interactions API rather than generateContent. The REST endpoint is POST https://generativelanguage.googleapis.com/v1beta/interactions, and the SDK call is client.interactions.create(). Every output carries a SynthID watermark, which Google states plainly in the image generation docs: "All generated images include a SynthID watermark."
Where the Nano Banana API key comes from
You create a Nano Banana API key in Google AI Studio, at aistudio.google.com/apikey. That single key works for every Gemini model, image models included. There is no separate image-only credential, and no key that is specific to Nano Banana.
The SDKs read it from the environment. Google's API key documentation accepts either GEMINI_API_KEY or GOOGLE_API_KEY, and notes that "If both are set, GOOGLE_API_KEY takes precedence." Two warnings from that page are worth repeating because image generation invites exactly the mistake they describe: "Never check API keys into source control systems like Git", and "Do not hardcode API keys directly in web or mobile apps. Keys compiled in client-side code can be extracted by users." Google's recommended fix is to "run a backend proxy server to make the actual API calls." An image generator is a tempting thing to wire straight into a front end, and a leaked key is a stranger spending your money at $0.24 an image.
Enterprise access runs through Vertex AI instead, which Google covers in Nano Banana Pro available for enterprise. Same models, different auth and governance: service accounts rather than a studio key, plus provisioned throughput and the compliance controls a studio key does not carry.
Nano Banana API pricing, per model and per resolution
Image pricing is charged per output image and varies by resolution, not by token count. These are Google's list prices from the Gemini API pricing page.
| Model | 512px | 1K | 2K | 4K |
|---|---|---|---|---|
| Nano Banana 2 Lite | n/a | $0.0336 | n/a | n/a |
| Nano Banana 2 | $0.045 | $0.067 | $0.101 | $0.151 |
| Nano Banana Pro | n/a | $0.134 | $0.134 | $0.24 |
Batch processing halves every number above. Note the shape of the Pro row: 1K and 2K cost the same, so if a render is going anywhere near print, asking Pro for 1K is leaving resolution on the table at no extra charge. Those are also the numbers to hold any reseller against. A wrapper charging more than Google's list price for the same model id is selling you convenience, and it is worth knowing exactly how much the convenience costs.
Is the Nano Banana API free?
No. Google's pricing page marks the free tier "Not available" for all three image models, so API use is billed from the first image. This is the single most common misconception about Nano Banana, and it comes from the fact that the surrounding products are free-ish: you can generate images in the Gemini app without paying, and you can try prompts in AI Studio, but neither of those is API access. The moment you call the endpoint from code, you are paying per image.
The Gemini API does have a free tier in general, and higher rate limits unlock when you link an active billing account. That free tier simply does not extend to the image models. Anything advertising a genuinely free Nano Banana API is either running on someone else's quota, rate limiting you severely, or subsidising a trial.
Nano Banana 2 API or Nano Banana Pro: picking the model id
Cost per image runs from $0.0336 to $0.24, a factor of seven, so model choice is the main lever on your bill. The routing rule we use:
- Nano Banana 2 Lite for flat, single-subject, high-volume work. Stickers, icons, simple thumbnails, anything you are generating hundreds of.
- Nano Banana 2 as the default for real work. Photorealism, lifestyle scenes, product shots with one or two text strings.
- Nano Banana Pro when the composition has many elements or several text labels, when several characters must stay recognizable, or when the output is going to print.
Reference image limits differ per model in a way the docs make easy to miss, and it matters if you are building a pipeline around them. Nano Banana 2 Lite takes up to 14 images total. Nano Banana 2 takes up to 10 object images, 4 character images, and 3 style references. Nano Banana Pro takes up to 6 object images and 5 character images. If your app assumes a flat cap of 14 across all three, it will start failing the moment you route a brief to Pro.
Paying for Pro does not fix a weak prompt, it just renders the same weak image more sharply. The prompt shape that actually moves these models, and the per-symptom fixes for bad renders, are in Nano Banana prompts.
How to use the Nano Banana API in code
The minimal call is three lines. Resolution and aspect ratio go in a response_format object rather than as top-level arguments, which is the part most people get wrong on the first try.
from google import genai
client = genai.Client() # reads GEMINI_API_KEY from the environment
interaction = client.interactions.create(
model="gemini-3-pro-image",
input="A die-cut sticker of a smiling red fox in a yellow raincoat, "
"bold black outlines, flat cel shading, plain white background",
response_format={"image_size": "2K", "aspect_ratio": "16:9"},
)image_size accepts 512px, 1K, 2K, and 4K, with the K uppercase. aspect_ratio accepts 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, and 21:9. Reference images are passed as array elements carrying a type of image, a mime_type, and base64 data.
That is the whole API. What it does not give you is everything around the call: retries when a render comes back wrong, a second opinion on whether the image matches the brief, consistent identity across a set, or a spend ceiling. Those are your problem, and they are most of the work in a real pipeline.
Google Nano Banana API access: three doors
There are three official ways in, and they differ in auth, governance, and how much you pay.
- Google AI Studio for trying prompts and minting a key. Free to experiment in, and the fastest way to see whether a model can do the thing at all.
- The Gemini API for anything programmatic. A studio key, list pricing, no free tier on images.
- Vertex AI for production and enterprise: service-account auth, provisioned throughput, data residency and safety controls.
A fourth door exists that is not Google: studios and routers that carry the models on their own billing. That is the one worth understanding on its merits rather than its marketing, because it is where most of the SERP lives.
Calling Nano Banana through an MCP server
If the caller is a coding agent rather than your own code, the Nano Banana MCP route removes the SDK entirely. Dream Pixel Forge exposes an MCP endpoint at https://www.dreampixelforge.com/api/mcp, a stateless Streamable HTTP endpoint authenticated with an Authorization: Bearer header. Keys look like dpf_ followed by 64 hex characters, and you mint one in the API keys section of settings.
Once connected, an agent calls get_image_models to see what is available and passes the key it wants as modelKey on generate_image. The Nano Banana models are gemini-image-lite, gemini-image, and gemini-image-pro. An explicit modelKey is never silently substituted: if that provider fails, the call fails and the credits are refunded, which matters when you asked for Pro specifically.
The full loop an agent runs is create_run, update_run to store a plan, generate_image per concept, vision to validate the result against the brief, then get_run for status and spend. Client-by-client setup for Claude Code, Cursor, and desktop connectors is in image generation MCP server.
Generating Nano Banana images from the CLI
For scripts and CI, the Nano Banana CLI path is the same surface without an agent driving it. The package is dreampixel-cli, it has no runtime dependencies, and it needs Node 20 or newer.
npm install -g dreampixel-cli
dpf login
dpf run create "Launch assets for a cold brew can"
dpf generate run_123 hero \
--prompt "A matte black cold brew can on wet slate, studio softbox lighting" \
--model gemini-image-pro --ar 16:9 --resolution 2kdpf login mints the key on your machine and sends only its SHA-256 hash to the server, storing the result in ~/.config/dpf/config.json at mode 0600. In CI, set DPF_API_KEY instead and skip the login. The rest of the command surface, including --json for piping into build scripts, is covered in AI image generator CLI.
What a routed API adds, and what it costs
Here the models are priced in credits rather than dollars per call: Nano Banana 2 Lite is 2 credits an image, Nano Banana 2 is 4, and Nano Banana Pro is 8 at 1K, 10 at 2K, and 16 at 4K. That is one balance across Nano Banana, Grok Imagine, GPT Image 2, FLUX Kontext Pro, and the video models, so switching models is a parameter change rather than a new vendor contract. Current packs are on pricing, and you can run the models by hand in the freeform image generator before wiring anything up.
What you get for that markup is the work the raw API leaves on your desk: automatic fallback when a provider fails, a vision pass that checks a render against the brief before you ship it, brand context the agent can read, and a per-key daily spend cap. The comparison against calling providers directly is laid out in image generation API for AI agents.
When is the raw Gemini API still the right call? When you are generating at real volume and every fraction of a cent matters, when you need Vertex-grade compliance controls, or when you have already built the retry and validation layer and do not want a second one. Going direct to Google is the cheapest possible path per image, and if image generation is the core of your product rather than a feature of it, that is usually where you end up.
The bottom line
The Nano Banana API is the Gemini API: keys from AI Studio, four model ids, prices from $0.0336 to $0.24 per image, no free tier, and calls through the Interactions API with image_size and aspect_ratio in response_format. Everything else in the search results is a wrapper around those facts.
Whether a wrapper is worth paying for comes down to one question: are you buying access, or are you buying the retry, validation, and routing layer you would otherwise write yourself? If it is access, go straight to Google. If it is the layer, look at what the wrapper actually does when a render comes back wrong. For a different model with a tighter content filter and stronger compositional instruction-following, GPT Image 2 is the comparison worth reading next.






