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 When the response holds no image, the function prints the error,
jq. This shell function saves the last non-thought image in a Gemini-native response, with the extension that matches its mimeType:promptFeedback, and finishReason fields instead.Generate an image
- cURL
- Python
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 at2K, 4096×4096 at4K - 16:9: 1376×768 at
1K, 2752×1536 at2K - Other ratios: see Google’s image generation guide
Edit images
Send the instruction first, then the reference images asinlineData 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.
- cURL
- Python
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:Ground images in Google Search
Add thegoogleSearch 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:
searchTypesmust be an object. Without it, the tool uses web search only;imageSearchalone 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, pointbase_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:
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 fromgemini-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"need1Kinstead, or should stay on Nano Banana 2. - Without a
thinkingLevel, Nano Banana 2.1 thinks atmedium, while Nano Banana 2 defaults tominimal. Setminimalexplicitly if you want the faster behavior.
How do I change the thinking level, and does it affect the price?
On the Gemini-native route, setgenerationConfig.thinkingConfig.thinkingLevel to minimal, medium, or high. Higher levels spend more effort on layout and text and take longer.
"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 setaspectRatio.
Related pages and sources
- Nano Banana overview — compare the five models, the two protocols, and billing
- Nano Banana 2 — when you need 512px output
- Nano Banana 2 Lite — low-cost 1K images
- Nano Banana Pro — complex layouts and brand-critical assets
- Gemini protocol — native request structure and SDK setup
- Google: Gemini Nano Banana 2.1 — official capabilities and limits
- Google: Nano Banana image generation — sizes, aspect ratios, and reference limits
- Call logs — check a request’s status and charge