Nano Banana API: call Google's image models from one endpoint.

Updated 2026-07-16

Nano Banana is Google's name for the Gemini family of native image generation models. Through the APIsRouter gateway, the ids nano-banana-2 and nano-banana-pro are addressable over a standard OpenAI-compatible image endpoint: one base URL, one key, the same request shape you already use for gpt-image-2.

Quick answer: what Nano Banana actually is.

Nano Banana started as a community nickname and became Google's official brand for Gemini's native image generation capability. As of July 2026 the family has four members, each mapping to a specific Gemini model: the original Nano Banana (Gemini 2.5 Flash Image, August 2025, now the legacy tier), Nano Banana Pro (Gemini 3 Pro Image, the premium model), Nano Banana 2 (Gemini 3.1 Flash Image, released February 26, 2026, the generalist workhorse), and Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image, released June 30, 2026, built for speed and scale). So "the Nano Banana API" is really the question of how you reach these models programmatically. Google's own path is the Gemini API with its Interactions request shape. The gateway path, which this guide covers, exposes the same models through the OpenAI-compatible image endpoint, so any code already written against /v1/images/generations can address them by id, next to GPT Image 2, without a Google Cloud account.

The first request: generate an image by model id.

The call is the standard OpenAI image-generation shape. Set the base URL to https://api.apisrouter.com/v1, pass your key as a Bearer token, and put the exact model id in the model field: nano-banana-2 for the workhorse, nano-banana-pro for the premium tier. The response carries the generated image in the data array, as a base64 payload or a URL depending on the serving path, so read data[0] and handle both fields. Before wiring it into an application, list /v1/models with your key and confirm the image ids you plan to use appear in the catalog. Ids are exact strings, and the listing is the source of truth for what your key can address today.

import 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="A cutaway diagram of a mechanical watch, engineering "
           "illustration style, labeled parts, clean off-white background",
    size="1024x1024",
)
image = result.data[0]  # .b64_json or .url depending on serving path

What the models can do, verified against Google's documentation.

One property worth knowing before you ship: every image these models produce carries Google's SynthID watermark, an invisible provenance mark embedded at generation time. That is a Google-side behavior of the models themselves and applies regardless of which endpoint served the request.

  • Text-to-image at multiple resolutions: Google documents 512px, 1K, 2K, and 4K output tiers for Nano Banana 2, with the 512px tier added specifically for high-volume efficiency. Nano Banana Pro covers 1K through 4K.
  • Image editing: both models accept an input image plus a text instruction and return the modified image, which covers inpainting-style edits, restyling, and object changes without a separate editing model.
  • Multi-image composition: Google documents reference-image inputs, up to 14 images on the strongest models, for combining subjects or keeping a character consistent across generations.
  • Text rendering inside images: a headline capability of the Gemini 3 era models. Nano Banana 2 renders legible, stylized, multilingual text; Pro is positioned as the strongest of the family at it.
  • Wide aspect-ratio support: standard ratios from 1:1 through 21:9, with Nano Banana 2 adding banner-style 4:1, 1:4, 8:1, and 1:8 options per Google's launch notes.
  • Grounded generation: on Google's own API the models can consult web search for factual grounding before generating. Treat this as a Gemini-API-side feature; do not assume it through a compatibility layer.

Prompting Nano Banana: what moves quality.

The Gemini image models respond best to prompts written as descriptions of a finished image rather than keyword lists. Describe the subject, the style, the lighting, and the composition in plain sentences. "A product photo of a ceramic mug on a walnut desk, soft window light from the left, shallow depth of field" outperforms a comma chain of tags. For text inside images, quote the exact string you want rendered and say where it goes: putting the words in quotation marks and naming the surface ("a poster with the headline 'OPEN LATE' in bold condensed type") is the reliable pattern. Shorter strings render more dependably than paragraphs. For edits, state the change and what must stay fixed: "replace the sky with an overcast one, keep the building and foreground unchanged". The models weight the instruction against the input image, so naming the invariants reduces drift. These models also reason before generating. Google exposes explicit thinking controls on its own API; through a compatibility layer you do not control that knob directly, so expect slightly longer latency on complex prompts and treat it as the model working rather than the endpoint stalling.

Nano Banana 2 or Pro: how to choose.

Google positions the two tiers cleanly. Nano Banana 2 is the versatile default: strong quality and text rendering at speed, the model for products, blogs, UI mockups, and bulk generation. Nano Banana Pro is the premium choice for the hardest visual tasks: the deepest world knowledge, the most precise creative control, brand consistency across assets, and the strongest text and localization handling. The practical rule: start on nano-banana-2, and step up to nano-banana-pro when a specific output shows its limits, dense infographic text, exact brand reproduction, or compositions that need every element placed deliberately. Because both sit behind the same endpoint, the upgrade is a one-string change, and the comparison is an A/B you can run in minutes. The dedicated Pro guide linked below covers the Pro tier in depth. Per-image cost differs by tier and by output resolution. Google's published Gemini API rates, checked July 2026, put Nano Banana 2 at $0.067 per 1K image and $0.15 per 4K image, with Pro at $0.134 per image at 1K and 2K and $0.24 at 4K. For what the same models cost through this gateway, the pricing page carries the current per-image rates; image models are billed per image, not per token.

Positioning per Google's model documentation and launch posts, checked July 2026.
TraitNano Banana 2 (nano-banana-2)Nano Banana Pro (nano-banana-pro)
Underlying modelGemini 3.1 Flash ImageGemini 3 Pro Image
PositioningGeneralist workhorse, speed with 4K qualityPremium tier for the most complex visual tasks
Text renderingReliable, multilingualStrongest of the family, localization-grade
Resolutions512px, 1K, 2K, 4K1K, 2K, 4K
Best forVolume generation, product shots, UI art, blogsInfographics, brand assets, precision composition

Editing and image-to-image through the gateway.

Editing calls pair an input image with an instruction. On the OpenAI-compatible surface that is the images edit route, which accepts the source image as multipart form data alongside the prompt and model fields. The Gemini models treat editing as a first-class capability, so the same ids work for generation and modification. Two practical notes. First, editing support and exact parameter handling on a compatibility layer can lag the native API; if an edit call errors on a parameter, simplify to image, prompt, and model, and check the docs page for the currently supported fields. Second, multi-turn refinement, where the model remembers the previous image across a conversation, is a Gemini-API-native feature (Google threads it through interaction ids on its own endpoint). Through a stateless image endpoint, achieve the same result by passing the previous output back in as the next edit's input image.

curl -s https://api.apisrouter.com/v1/images/edits \
  -H "Authorization: Bearer $APISROUTER_API_KEY" \
  -F model="nano-banana-2" \
  -F image="@product-shot.png" \
  -F prompt="replace the background with a soft studio gradient, keep the product and shadows unchanged"

Why route Nano Banana through a gateway at all.

The trade is the usual gateway trade: your requests transit one more hop, and native-API features arrive on the compatible surface with a lag. For most application code that calls generate-and-save, the single integration wins; for pipelines built on Gemini-specific features like grounded generation with search, the native API remains the right tool.

  • No Google Cloud account or billing setup: top-up based access with one key, which matters in regions where vendor sign-up is the hard part.
  • One integration for Google and OpenAI image models: nano-banana-2, nano-banana-pro, and gpt-image-2 answer on the same endpoint, so a model bake-off is a string swap.
  • One usage log: per-request model and spend in one console, instead of separate Google and OpenAI billing exports.
  • Same key as your text models: an app that already routes Claude or GPT text traffic through the gateway adds image generation without new credentials.

FAQ

What is the Nano Banana API?

Nano Banana is Google's brand for the Gemini native image generation models. Programmatic access is via Google's Gemini API, or through an OpenAI-compatible gateway like APIsRouter where the ids nano-banana-2 and nano-banana-pro answer on POST /v1/images/generations with a single key.

Which Gemini model is Nano Banana 2?

Gemini 3.1 Flash Image, released February 26, 2026. It is the generalist model of the family: fast, strong world knowledge, reliable multilingual text rendering, and output up to 4K. Nano Banana Pro is Gemini 3 Pro Image, the premium tier, and Nano Banana 2 Lite (Gemini 3.1 Flash Lite Image, June 30, 2026) is the speed tier.

Can Nano Banana edit existing images?

Yes. The models accept an input image plus a text instruction and return the modified image, covering restyling, background swaps, and object edits. Through the gateway that is the /v1/images/edits route with the image attached as form data and the same model ids.

How much does the Nano Banana API cost?

Billing is per image and varies by resolution tier. Google's published Gemini API rates, checked July 2026, list Nano Banana 2 from $0.045 per 512px image up to $0.15 at 4K, and Pro at $0.134 for 1K and 2K. For gateway rates on the same ids, see the APIsRouter pricing page, which carries the current per-image prices.

Do I need a Google account to use Nano Banana through APIsRouter?

No. The gateway holds the upstream relationship. You top up a balance, receive a key, and call the models by id over the OpenAI-compatible endpoint. The same key addresses the text catalog and GPT Image 2.

Are Nano Banana images watermarked?

Yes. Google embeds its SynthID invisible watermark in images generated by the Gemini image models at generation time. This is a property of the models themselves, so it applies through any endpoint, native or gateway.