Skip to main content
Nano Banana 2.1 (gemini-nano-banana-2.1) is Google’s October 2026 update to Nano Banana 2, with sharper text rendering, more accurate infographic layouts, and better consistency across multi-turn edits. On LaoZhang API it costs $0.045 per call, less than Nano Banana 2.

What Nano Banana 2.1 supports

To compare all five Nano Banana models, see the Nano Banana overview.

Nano Banana 2.1 or Nano Banana 2?

Both models take the same request and return the same response shape, so switching means changing only the model ID.
  • New projects and 1K to 4K output: use Nano Banana 2.1. It costs less per call and handles text and layout better.
  • 512px previews: stay on Nano Banana 2. Nano Banana 2.1 returns HTTP 400 for 512.
  • Nano Banana 2 remains available at the same price, so existing integrations don’t have to move.

Before you call

1

Create an API key

In Token management, create a key in the default group and set Billing mode (计费模式) to Usage first (按量优先, recommended) or Per-call (按次计费). A Usage-based (按量计费) key can’t call per-call models such as Nano Banana 2.1.
2

Set the key and install the dependencies

3

Add a save function for cURL

The cURL examples need jq. This shell function saves the last non-thought image in a Gemini-native response, with the extension that matches its mimeType:
When the response holds no image, the function prints the error, promptFeedback, and finishReason fields instead.
A request usually takes 15 to 40 seconds, and 4K takes longer. The examples allow 300 seconds; give your client and any proxy the same headroom.

Generate an image

The image comes back as Base64 in candidates[0].content.parts[].inlineData.data, and mimeType gives its format. Both examples decode it and save a matching PNG, JPEG, or WebP file. Without aspectRatio, the model picks the frame from the prompt. Common output sizes:
  • 1:1: 1024×1024 at 1K, 2048×2048 at 2K, 4096×4096 at 4K
  • 16:9: 1376×768 at 1K, 2752×1536 at 2K
  • Other ratios: see Google’s image generation guide

Edit images

Send the instruction first, then the reference images as inlineData parts, and refer to the images by their order in the prompt (“the first image”, “the second image”). Nano Banana 2.1 accepts up to 14 references: at most 10 object images and 4 character images.
This request combines two local files. Build the body with jq so large images don’t exceed shell argument limits, and keep each mimeType consistent with its file:
Say what must stay unchanged, and describe one change per request when you need precise control. To keep people consistent across a series, pass their photos as character references (up to 4). Add the googleSearch tool when an image depends on current facts or on what a real landmark looks like. This request turns on both web search and image search, and allows TEXT so any text the model writes comes back too:
  • searchTypes must be an object. Without it, the tool uses web search only; imageSearch alone uses image search only.
  • The model decides whether to search and which type to use. The queries it ran appear in groundingMetadata.
  • Image search can’t currently use real-world images of people as references.
  • If you show grounded results to end users, display search suggestions as Google’s grounding guide requires.
  • Each search adds $0.014 to the $0.045 call, so a request that runs 2 searches costs $0.073. Call logs show the number of searches; see the Nano Banana billing rules.

Use the OpenAI-compatible route

If your app already uses the OpenAI SDK, point base_url at https://api.laozhang.ai/v1 and set model to gemini-nano-banana-2.1. This route has no ratio or size settings: it returns a 1K image whose frame the model picks from the prompt, often 16:9. For a fixed ratio or 2K and 4K, use the Gemini-native route. The image comes back as a Base64 data URL inside message.content. Save this script as nano_banana_21_chat.py:
Generate an image, then edit a local file:

Errors and billing

Invalid parameters return HTTP 400 and aren’t charged:
  • Each call costs $0.045, whatever the output size, thinking level, number of references, or whether it generates or edits.
  • Google Search grounding adds $0.014 per search.
  • A request can return HTTP 200 without an image, for example when the prompt doesn’t ask for one or a safety check blocks the output. It is charged as one call. Check finishReason, then change the prompt or references before resending; see Avoid paying for empty responses.
  • Retry 429 and 5xx responses with backoff, and check call logs before resending a request that timed out.

FAQ

What do I change to move from Nano Banana 2?

Change the model ID from gemini-3.1-flash-image to gemini-nano-banana-2.1; the request and response stay the same. Then check two things:
  • Requests that set "imageSize": "512" need 1K instead, or should stay on Nano Banana 2.
  • Without a thinkingLevel, Nano Banana 2.1 thinks at medium, while Nano Banana 2 defaults to minimal. Set minimal explicitly if you want the faster behavior.

How do I change the thinking level, and does it affect the price?

On the Gemini-native route, set generationConfig.thinkingConfig.thinkingLevel to minimal, medium, or high. Higher levels spend more effort on layout and text and take longer.
The price stays at $0.045 per call for all three levels; Google itself bills thinking tokens on top. If you also set "includeThoughts": true, the response adds thought text and draft images marked "thought": true. The save_image function and the Python script skip them.

Does 4K cost more than 1K?

No. Every call costs $0.045. Google bills by output tokens, about $0.113 for a 4K image and $0.0336 for 1K, according to its pricing page. If you only need 1K images, Nano Banana 2 Lite costs less per call.

Why does the OpenAI-compatible route return landscape images?

That route can’t pass an aspect ratio, so the model chooses the frame from the prompt, often 16:9. For square or portrait output, use the Gemini-native route and set aspectRatio.