Skip to main content
LaoZhang API serves five Nano Banana models, Google’s current Gemini image models, at a fixed price per call with no Google account required. Use this page to pick a model and a request format, and to get the shared code the model guides build on.

Compare the models

  • This site labels the original model, gemini-2.5-flash-image, as Standard so it isn’t confused with the family name. Its shutdown date and migration are covered on this page.
  • Every model accepts OpenAI-compatible and Gemini-native requests; only Gemini-native requests can set the aspect ratio and output size. See Choose a protocol.
  • Prices are LaoZhang API public pricing as of October 7, 2026; see Models and pricing for the current list.
  • Single 2K, 16:9 requests with the same prompt on October 14, 2026 took 25 s on Nano Banana 2.1, 21 s on Nano Banana 2, and 69 s on Nano Banana Pro; see the side-by-side samples in the Nano Banana 2.1 guide.
  • The table after this list gives the 10 aspect ratios and the four that Nano Banana 2.1 and Nano Banana 2 add.
  • On the OpenAI-compatible route there is no ratio or size setting. From a text-only prompt, Standard returns 1024×1024 images, Nano Banana 2.1 returns a 1K image in a frame the model picks, and the other models return 1:1 images at 1K.
  • A dash (—) means Google doesn’t list the feature for Standard. Capabilities come from Google’s Nano Banana image generation guide.
For which model to start with, see the FAQ; to compare Nano Banana with other image models, see Choose an image API. All five models share these rules:
  • No platform concurrency limit and no throttling; a 429 comes from upstream capacity, see Concurrency and 429.
  • Each model has one fixed per-call price. What is charged when a request fails or returns no image is in Billing, and Billing and failure rules compares the three image families.
Actual outputs of the generate example on each model’s guide:
A corner cafe after rain with a BANANA CAFE sign, generated by Nano Banana 2.1

Nano Banana 2.1, 2K

A night market noodle stall, generated by Nano Banana 2

Nano Banana 2, 2K

A futuristic skyline with a NEO TOKYO billboard, generated by Nano Banana Pro

Nano Banana Pro, 4K

A logistics dashboard with cyan highlights, generated by Nano Banana 2 Lite

Nano Banana 2 Lite, 1K

Choose a protocol

Both endpoints take the same API key and the same model IDs:
OpenAI-compatible suits apps that already use the OpenAI SDK. The image arrives as Base64 in choices[0].message.content, usually as a Markdown image such as ![image](data:image/png;base64,iVBORw0...). Read the format from the data URL instead of assuming PNG. An image_url input can be a data URL made from a local file or a public HTTPS URL. Gemini-native exposes every image option. Put them in generationConfig.imageConfig:
  • aspectRatio takes a value from the model’s list.
  • imageSize takes a size with the K in uppercase; some models reject lowercase sizes such as 2k. The values each model accepts are in the table below.
The response lists each image as an inlineData part with mimeType and Base64 data. To call this endpoint with the Google Gen AI SDK, see Gemini protocol for the base URL.

Billing

LaoZhang API offers Nano Banana with per-call billing only: each model has one price, whatever the output size, thinking level, number of references, or whether you generate or edit. The only extra charge is for Google Search grounding, billed per search as described below. This table compares LaoZhang API’s per-call prices with Google’s prices: Google’s figures are its Standard paid rates converted per output image, verified November 5, 2026; Google also bills input and thinking tokens. The saving grows with resolution: a 4K image from Nano Banana 2, for example, costs about 64% less than Google’s standard price. Because Nano Banana models have only a per-call price, use a key whose billing mode is Usage first (按量优先, recommended) or Per-call (按次计费), as in Set up. A Usage-based (按量计费) key calls only usage-based models, so it can’t call Nano Banana. See Billing and pricing for how the modes differ. Call logs are the record of each request’s status and charge:
  • HTTP 200 with no image: charged as one call. An HTTP 200 from upstream counts as a completed call, for generation and editing alike. LaoZhang API doesn’t review prompts or outputs, so it doesn’t bill by whether an image came back. See Avoid paying for empty responses.
  • Client timeout: the server may still finish the image and charge for it. Check call logs before you retry so you don’t pay twice.
  • Non-200 upstream response: a 400, 429, 503, or similar response that never reached generation is not charged.
  • Google Search grounding: $0.014 per search on top of the per-call price. This matches Google’s $14 per 1,000 searches and applies to Nano Banana 2.1, Nano Banana 2, and Nano Banana Pro.
    • The model decides how many searches to run, and the count can vary for the same prompt. Call logs show the number of searches and their charge for each request.
    • For example, a Nano Banana 2.1 request that runs 2 searches costs $0.045 + 2 × $0.014 = $0.073.

Avoid paying for empty responses

An HTTP 200 with no image usually has one of two causes:
  • The prompt never asks for an image. If it only describes what you want, without saying “generate an image” or “return the edited image”, the model may reason about it and reply with text or nothing.
  • Upstream safety filters block the content. When the prompt or a reference image involves copyrighted characters, sensitive people, or sensitive content, Google returns no image and no error code. Resending the same content is usually blocked again, and each attempt is charged.
Content that often trips Google’s safety filters:
  • sexual, violent, gory, or hateful content, including suggestive borderline content
  • removing a watermark from an image
  • well-known copyrighted characters, such as Disney, Marvel, or Nintendo characters
  • inappropriate content involving minors
  • public figures such as celebrities and politicians
  • editing financial details such as order screenshots, receipts, or price tags
  • changing a real person’s clothes or swapping faces
Google’s filtering is somewhat random: the same prompt can produce an image one time and be blocked the next, and the rules change as Google updates them. A blocked request usually returns a short refusal in text. Before you run a batch, handle these cases in your client:
  1. Ask for an image explicitly in every prompt.
  2. Screen prompts and reference images yourself before sending them, and remove content likely to trip safety filters.
  3. Treat a response with no candidates, or with no inlineData part, as “no image”. When candidates is present, read finishReason and any returned text to see why.
  4. Don’t retry an empty response automatically. Change the prompt or references first. Keep backoff retries for 429 and 5xx errors.

Set up

1

Create an API key

In Token management, open the create-token dialog (创建令牌), set Billing mode (计费模式) to Usage first (按量优先, recommended) or Per-call (按次计费), and click Create (创建). The default group includes all five Nano Banana models.Create-token dialog in the LaoZhang API console with Billing mode set to Per-call (按次计费)
2

Store the key in an environment variable

3

Install the dependencies

The cURL examples also need jq, for example brew install jq or sudo apt-get install jq.

Python helper

Save this module as nano_banana.py. It authenticates on both routes, turns local files into image inputs, and saves every returned image with the extension that matches its bytes (PNG, JPEG, or WebP):
In Python, import the functions you need. After a cURL request, run python nano_banana.py response.json output-name to save the images from the response file:
  • The first image is written as output-name.png (or .jpg or .webp).
  • Any further images are written as output-name-2, output-name-3, and so on.

Nano Banana Standard

gemini-2.5-flash-image is the original Nano Banana model. It creates images at about 1K: a text-only prompt on the OpenAI-compatible route returns 1024×1024, and the Gemini-native route accepts the 10 aspect ratios listed above (16:9, for example, comes back as 1344×768).
Google has deprecated gemini-2.5-flash-image and plans to shut it down on March 15, 2027. LaoZhang API can stop serving it earlier, so migrate now.
  • As of November 5, 2026, both the deprecations page and the pricing page list that date, and the pricing page’s earlier October 2, 2026 warning is gone. As of October 5, 2026, LaoZhang API still serves it at the same price.
  • Move to Nano Banana 2.1 (gemini-nano-banana-2.1) or Nano Banana 2 (gemini-3.1-flash-image); Nano Banana 2 Lite (gemini-3.1-flash-lite-image) is a lower-cost option for 1K images.

Generate an image

These examples use the Python helper.
The result is saved as standard-fox.png, .jpg, or .webp, depending on the returned format. For a ratio other than 1:1, call the Gemini-native endpoint with aspectRatio and no imageSize:

Edit an image

Send the instruction and the image in one user message; to_data_url turns a local file into a data URL with the matching MIME type:
For cURL requests, combining up to three images, setting the aspect ratio of an edit, and writing edit instructions, see Nano Banana image editing (Standard).

Move to a newer model

Requests keep the same format across Nano Banana models, so switching mostly means changing model. Nano Banana 2 Lite keeps 1K output and the same 10 aspect ratios; Nano Banana 2.1 and Nano Banana 2 add larger sizes, 14 ratios, and up to 14 references, as listed in Compare the models. With the Python helper, the lighthouse request above runs on Nano Banana 2 with a new model ID, and it can now also set imageSize:
Run your usual prompts again after switching, because a newer model can interpret the same prompt differently. To move edit requests, follow Migrate to Nano Banana 2 in the editing guide.

Large images and image URLs

Keep the whole request body, Base64-encoded images included, under 20 MB, and pass larger reference images by URL with fileData. Base64 adds about a third to a file’s size, so images sent as inlineData should total about 15 MB or less. On the Gemini-native route, fileData and inlineData parts can sit in the same parts array. They count as the first, second, and later reference images in the order you list them. This request body sends the photo of the person by URL and the jacket as Base64:
A URL keeps the request body to a few hundred bytes, so high-resolution photos tens of megabytes in size work this way too. The server downloads the image, so the URL must meet these conditions:
  • It’s a direct HTTPS link that needs no login, cookies, or Referer, and sits behind no CAPTCHA, Cloudflare challenge, or User-Agent filter.
  • The site’s robots.txt doesn’t block crawlers from the image’s path.
  • A signed URL stays valid long enough to cover queueing and retries; allow at least 30 minutes.
  • mimeType matches the real format: image/jpeg for JPEG, image/png for PNG, image/webp for WebP.
If the image can’t be downloaded, the request returns 400 with Cannot fetch content from the provided URL and isn’t charged. The OpenAI-compatible route also accepts a public image URL in image_url.url, under the same conditions.

Troubleshooting

  • HTTP 400 with Cannot fetch content from the provided URL. The server couldn’t download the image in fileData. Work through the conditions in Large images and image URLs.
  • HTTP 413. The request body is too large. Pass large images by URL with fileData, or downscale them so the whole request stays under 20 MB.
  • HTTP 200 but no image. The OpenAI-compatible reply contains only text, or the native response has no inlineData part. The call is already charged, so don’t resend it unchanged; fix the prompt or references as described in Avoid paying for empty responses.
    • In native responses, check finishReason, and promptFeedback if the response includes it.
    • Example values include IMAGE_SAFETY, IMAGE_PROHIBITED_CONTENT, and NO_IMAGE.
  • HTTP 401. Check the API key and the Authorization: Bearer header. Use a model API key from Token management, not an account AccessToken.
  • HTTP 400. Check the model ID, the JSON body, and that aspectRatio and imageSize are on the model’s list, with an uppercase K.
  • HTTP 429, 5xx, or a timeout. Retry with exponential backoff; after a timeout, check call logs first, as described in Billing.

FAQ

How do I get an API key for Nano Banana?

Register on LaoZhang API, then create a token in Token management: choose the default group and the Usage first (recommended) or Per-call billing mode. The sk- string you get is the API key for all five Nano Banana models. After topping up, send the first request with the Python helper and check each charge in call logs.

Can I call Nano Banana without a Google account?

Yes. You need only a LaoZhang API key, not a Google Cloud project, a Gemini API key, or a Google account. All five models come from Google’s official channel, take the same request format as Google’s native API, and are billed per call.

Which Nano Banana model should I start with?

Start with Nano Banana 2.1 (gemini-nano-banana-2.1). It updates Nano Banana 2 with better text and layout and costs less per call; Compare the models lists each model’s sizes and ratios. Use Nano Banana 2 when you need 512px output, Nano Banana 2 Lite for large volumes of 1K images and Nano Banana Pro for complex layouts or brand-critical assets. Don’t start new work on Standard: Google has deprecated it and plans to shut it down on March 15, 2027. If you already use it, move single-image 1K edits to Nano Banana 2 Lite and multi-image composites to Nano Banana 2.1 or Nano Banana 2, which take the same request, as described in Migrate to Nano Banana 2.

Can the OpenAI-compatible route return 16:9 or 4K images?

No. Chat completions requests have no aspect-ratio or size fields, so there is no way to ask for them. Send the same prompt to the Gemini-native endpoint with aspectRatio and imageSize.

How much does the Nano Banana API cost per image?

Each model has one fixed price per call, and each call returns one image:
  • Nano Banana 2 Lite: $0.025
  • Nano Banana 2.1: $0.045
  • Nano Banana 2: $0.055
  • Nano Banana Pro: $0.09
Output size doesn’t change the price, so 2K and 4K images cost less than at Google’s standard rates; a 4K image from Nano Banana Pro, for example, costs about $0.24 at Google. Billing compares each tier.

Do output size, references, or editing change the price?

No. Each model has one per-call price: a 512px or a 4K image, the default or high thinking level, one reference or fourteen, a generation or an edit all cost the same. Only Google Search grounding adds a charge, $0.014 per search. Billing compares the prices with Google’s.

Am I charged when a request fails, times out, or returns no image?

An HTTP 200 with no image is charged as one call, including when the prompt didn’t ask for an image or upstream safety filters blocked it. A client timeout may also be charged, while a non-200 upstream response, such as 429 or 503, isn’t. Each request’s status and charge appear in call logs. Billing explains how to handle each case.

Can one request return several images?

Don’t rely on it. Google notes that the model won’t always return the number of images a prompt asks for. To get several images, send several requests; each is billed as one call. A single response can still hold more than one image: Gemini 3 image models create interim images while thinking to test the composition, and these can come back with the result. The last image is the final one. The Python helper saves every image in order, so the file with the highest number is the last.

Which prompt languages work best?

Google lists English and 14 other language locales as the best-performing prompt languages, including Chinese (zh-CN), Japanese, Korean, Spanish, German, and French. Prompts in other languages can work, but results may be less consistent.

Do generated images carry a watermark?

Yes. Google states that every image a Nano Banana model generates includes a SynthID watermark. SynthID is embedded in the image, is imperceptible to people, and lets tools identify the image as AI-generated.

Which input image formats can I send?

Google lists PNG, JPEG, WebP, HEIC, and HEIF as supported image formats. The examples on this site and the Python helper handle PNG, JPEG, and WebP, so convert HEIC or HEIF photos to JPEG first. Whatever the format, the mimeType or data URL prefix must match the file’s real format. Downscale very large photos before you send them. For the request size limit and sending images by URL, see Large images and image URLs.

Why does a pure white background show dark spots or smudges?

Nano Banana runs on Google’s AI Studio route, and large pure-white areas sometimes come back with dark spots, smudges, a gray haze, or a color cast, more often at peak times. Ask for a different light background instead:
  • light gray: light gray background, #F5F5F5
  • beige: beige background, #F5F0E5
  • light blue: light blue background, #E8F0F8
Changing only the background description doesn’t affect the subject’s colors. If you need pure white, replace the background in your own post-processing. Flawed images are billed like any other call, so check a few samples before a large batch.