How to use Nano Banana: from the Gemini app to your first API call.

Updated 2026-07-16

Nano Banana is Google's Gemini image model family. Casual use lives in the Gemini app; anything repeatable, an app feature, a batch job, a pipeline, wants the API. This guide covers both, then walks the API path step by step through one OpenAI-compatible endpoint with the ids nano-banana-2 and nano-banana-pro.

Quick answer: two ways to use Nano Banana.

For one-off images, open the Gemini app or gemini.google.com, describe the image you want, and iterate conversationally: "make it wider", "change the text to say OPEN LATE". That path needs no setup, and it is genuinely the right tool for casual use, brainstorming, and personal images. The app path stops scaling the moment images become part of something you are building. Quotas are consumer-shaped, output arrives by hand, there is no way to script it, and the model choice is whatever the app decides. The API path fixes all four: you pick the exact model id, send a request from code, and get the image back in the response. Through the APIsRouter gateway that request is the standard OpenAI image call, POST /v1/images/generations with model nano-banana-2 or nano-banana-pro, one key, no Google account.

Know which Nano Banana you are using.

The name covers a family, and knowing which member answers matters because quality, speed, and price differ. As of July 2026: Nano Banana 2 (Gemini 3.1 Flash Image, released February 2026) is the mainline model and the right default; Nano Banana Pro (Gemini 3 Pro Image) is the premium tier for the hardest compositions and the most demanding text rendering; Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image, released June 30, 2026) is the speed tier; and the original Nano Banana (Gemini 2.5 Flash Image, 2025) is legacy. In the Gemini app you mostly cannot pick; the app decides. On the API you address the model by exact id, which is the first practical advantage of the developer path: nano-banana-2 in the model field always means the same model, and an upgrade to Pro is a deliberate one-string change you control.

The API path, step by step.

Step one: get a key. On APIsRouter you start free without a card; the key arrives by email and works immediately. Step two: verify what your key can address. List /v1/models with the key and look for the image ids. This one call proves auth works and shows the exact strings to use, which prevents the most common first-request failure, a mistyped model id. Step three: send the first generation request. The example below is complete: base URL, key, model, prompt, size. Run it, decode the base64 payload or fetch the URL in data[0], and you have your first Nano Banana image from code. Step four: only then integrate. Wrap the call in your application once the standalone request works, so integration bugs and endpoint bugs stay distinguishable.

import base64, os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["APISROUTER_API_KEY"],
    base_url="https://api.apisrouter.com/v1",
)

result = client.images.generate(
    model="nano-banana-2",
    prompt="Flat-lay photo of a breakfast table, morning light, "
           "linen tablecloth, film photography look",
    size="1024x1024",
)

img = result.data[0]
if getattr(img, "b64_json", None):
    with open("breakfast.png", "wb") as f:
        f.write(base64.b64decode(img.b64_json))
else:
    print("image url:", img.url)

Prompt patterns that work on this family.

One behavior to expect: these models think before they draw. Complex prompts can take noticeably longer than trivial ones, and that latency is reasoning, not a hung request. Set client timeouts generously for image calls, sixty seconds is a reasonable floor, and treat sub-second failures as configuration problems rather than model problems.

  • Write scenes, not tags. "A lighthouse on a cliff at dusk, long exposure, waves blurred to mist" beats "lighthouse, cliff, dusk, long exposure, 4k, masterpiece". The Gemini models parse natural sentences.
  • Quote text you want rendered. For words inside the image, put the exact string in quotation marks and name where it appears: a sign, a label, a headline. Short strings render most reliably.
  • Name the style explicitly. "Engineering illustration", "risograph print", "1970s postcard": the models have broad style knowledge and follow named styles better than adjective piles.
  • Specify composition when it matters. Camera angle, framing, what is in the foreground: unstated composition is model's choice.
  • For edits, state the invariant. "Change X, keep everything else unchanged" is the phrase that keeps edits from drifting.
  • Iterate by diff. When a result is close, describe the delta ("same image, warmer light, remove the second chair") rather than rewriting the whole prompt.

Common failure modes and their fixes.

A 401 means the key is not reaching the endpoint: the usual causes are an unexported environment variable or a key pasted with whitespace. Re-run the /v1/models check from the same shell as the failing code. A model-not-found error means the id string does not match the catalog. Ids are exact, so copy them from the /v1/models output rather than typing from memory, and remember that Google's own SDK names (gemini-3.1-flash-image) are not the gateway ids (nano-banana-2). A 400 on a parameter usually means an option the serving path does not accept for that model. Reduce the request to model, prompt, and size, confirm that works, then reintroduce options one at a time. Requested sizes outside a model's supported set fail the same way; stay on standard tiers like 1024x1024 until you have a reason not to. Empty or refused generations happen when a prompt trips content policy: the fix is rephrasing, not retrying. And garbled text inside images is a prompt problem more often than a model problem: shorten the string, quote it, and if it still fails on nano-banana-2, that specific job is what nano-banana-pro is for. If output quality suddenly looks different week to week, check which model actually served the request before blaming your prompt: the response carries the model id back, and pinned exact ids are the way to keep results reproducible.

What Nano Banana costs, app vs API.

In the Gemini app, image generation is bundled into Google's consumer tiers: free with daily limits, more under the paid Google AI plans. Those quotas are per-person and fine for casual use. The API bills per image, and the price depends on model and resolution. Google's published Gemini API rates, checked July 2026, put Nano Banana 2 at $0.045 per image at 512px, $0.067 at 1K, $0.101 at 2K, and $0.15 at 4K; Nano Banana Pro runs $0.134 at 1K and 2K and $0.24 at 4K. Through the gateway the same ids are billed per image against a prepaid balance; the pricing page lists the current per-image rates, and the console shows spend per request so a batch job's cost is visible while it runs, not at month end. The budgeting rule of thumb: resolution is the multiplier that matters. A pipeline that renders drafts at 512px or 1K and re-renders only approved images at 2K or 4K spends a fraction of one that generates everything at maximum size.

Three access paths to the same model family, checked July 2026.
UsageWhere it runsHow it billsRight for
Gemini appgemini.google.com, mobile appsConsumer plan quotasOne-off images, iteration by chat
Gemini API (Google)Google AI Studio / Vertex AIPer image, by resolution tierPipelines committed to Google's stack
APIsRouter gatewayOpenAI-compatible /v1 endpointPer image, prepaid balanceApps that also use OpenAI-shape APIs, no Google account

From first image to production habit.

The through-line: the app is for using the model, the API is for building with it. If you found this page by outgrowing the Gemini app, the five-minute version of the switch is a key, one curl to /v1/models, and the Python script above.

  • Pin exact ids in code and configs. nano-banana-2 today should mean nano-banana-2 next month; upgrades should be deliberate.
  • Create a key per project. Keys are free, and per-key usage turns the console into a per-project cost report.
  • Cache generated assets. Identical prompts bill as new generations; store outputs keyed by prompt hash if your app can re-request.
  • Draft low, finalize high. Iterate at small sizes, spend 4K only on keepers.
  • Watch the usage log during the first batch run. Per-request spend visibility is how a mis-sized loop gets caught at image fifty instead of image five thousand.

FAQ

How do I use Nano Banana for free?

In the Gemini app, image generation is available on Google's free consumer tier with daily limits. On the API side, APIsRouter starts free without a card, so the first images through the gateway cost nothing while you evaluate.

How do I access Nano Banana as an API?

Either through Google's Gemini API with a Google account, or through an OpenAI-compatible gateway. On APIsRouter, point any OpenAI SDK at https://api.apisrouter.com/v1 and call images.generate with model nano-banana-2 or nano-banana-pro.

Which Nano Banana model should I start with?

nano-banana-2. It is Google's generalist tier: fast, strong text rendering, output to 4K. Step up to nano-banana-pro only when a concrete output shows its limits, typically dense in-image text or precision composition.

Can I use Nano Banana without a Google account?

Through a gateway, yes. APIsRouter holds the upstream relationship; you top up a balance and call the models by id with one key, which also covers GPT Image 2 and the text catalog.

Why do my Nano Banana requests take so long?

The Gemini image models reason about complex prompts before generating, so multi-element compositions take longer than simple ones. Set client timeouts to sixty seconds or more for image calls. Consistent instant failures are configuration issues, not latency.

How do I make Nano Banana render text correctly?

Quote the exact string in the prompt, keep it short, and name the surface it appears on. If nano-banana-2 still garbles a hard case, run the same prompt on nano-banana-pro, which Google positions as the strongest text renderer in the family.