Back to Articles
Nano BananaImage APIPython

Nano Banana API: Choose a Model and Generate Your First Image

Compare Nano Banana 2, Lite and Pro, get an EntireFeed API key, and use a complete Python example to estimate, generate, edit and download images.

EntireFeed Team·

Start with Nano Banana 2 at 1K if you want to build a general image-generation or editing workflow. Try Lite when a single 1K image is enough and you want the lowest published output rate in this family. Compare Pro on your own difficult prompts when creative detail matters more than the output price.

This guide uses EntireFeed's API: one request format for these three models, a free estimate endpoint, prepaid billing and an asynchronous generation record. If you want Google's native Gemini SDK and credentials instead, start with Google's image-generation documentation. The API keys and request bodies are different.

Download the complete Python example, or follow the model and setup notes first. The script estimates by default; it only creates paid work after you enable generation and confirm.

A real generation and edit

We ran the exact prompts below through EntireFeed's public API on September 13, 2026, using Nano Banana 2, 1K resolution and a 1:1 aspect ratio. The first request generated the blue mug. The second used that output as its reference and asked for a terracotta glaze.

Generated cobalt-blue ceramic mug with a white sun symbol on an ivory background
Generated image · Nano Banana 2 · $0.04
Edited terracotta-orange ceramic mug retaining the white sun symbol and ivory setting
Edited image · Nano Banana 2 · $0.04

Both files are 1024 × 1024 PNGs. The settled charges were $0.08 total for this pair. The edit changes the glaze while keeping the sun motif, handle and overall composition recognizable; inspect details when exact preservation matters. This is one worked example, not a quality benchmark across models.

Which Nano Banana model should you use?

“Nano Banana” is a family name. The public model ID is the value you send to EntireFeed in model; it is not the Google model name.

EntireFeed models · one 1K output, references included
Model and pricingAPI model ID1K output rate
Nano Banana 2nano-banana-2$0.04
Nano Banana 2 Litenano-banana-2-lite$0.02
Nano Banana Pronano-banana-pro$0.09

The Google names are gemini-3.1-flash-image for Nano Banana 2, gemini-3.1-flash-lite-image for Lite, and gemini-3-pro-image for Pro. Google's older gemini-2.5-flash-image is a separate model; it is not one of these three EntireFeed IDs. Google's model guide explains the family.

Use resolution and reference needs to narrow the choice:

  • Nano Banana 2: the starting point for this tutorial. It supports 1K, 2K and 4K output, up to 14 reference images, and the wider aspect-ratio set, including 1:4 and 8:1.
  • Nano Banana 2 Lite: 1K output only in EntireFeed's current API. Google says it is not optimized for multiple reference inputs or sequential editing. A schema accepting references does not promise the same result quality as the other variants.
  • Nano Banana Pro: 1K, 2K and 4K output. Its exposed aspect ratios run from 1:1 through 21:9, including portrait options such as 9:16; it does not expose the extreme 1:8 or 8:1 ratios.

The reference limit is 14 images for Nano Banana 2, 10 for Lite and 8 for Pro. Use JPEG, PNG or WebP files up to 30 MB each. Prompts can contain up to 20,000 characters for Nano Banana 2 and Lite, or 10,000 for Pro. These are EntireFeed's current contracts; Google's native API can differ. Review the live model and input contracts before building controls around them. Public inputs cover prompt, resolution, aspect ratio and references. They do not expose a Google Search grounding switch, transparent-output setting or a persistent multi-turn conversation.

Get an API key and prepare your balance

  1. Create an EntireFeed Console account.
  2. In Console, open Credentials and create a media-generation API key for your organization. Keep it on your server or in a local environment variable.
  3. Open Billing and add prepaid balance before generating. An estimate is free and does not generate an image.

Use an EntireFeed key with https://api.entirefeed.com/v1. A Gemini or Google AI Studio key does not authenticate to this endpoint. See authentication and billing and usage for the current setup contract.

Estimate and generate an image with Python

The example asks for one product photograph: a cobalt-blue ceramic mug, a white sun symbol and a warm ivory background. Explicit subject, composition, lighting and text requirements make the result easier to assess than a vague prompt.

Download nano-banana.py. It uses Python 3.11 or newer and declares its requests dependency for uv. Run it from the directory where you saved the file:

uv run nano-banana.py

That sends this request to POST /v1/estimate:

{
  "task": "image.create",
  "model": "nano-banana-2",
  "input": {
    "prompt": "Studio product photograph of a cobalt-blue ceramic mug on a warm ivory background. A small white sun symbol on the front, no lettering. Soft window light from the left, realistic glaze, gentle shadow, square composition with generous empty space.",
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }
}

Check the returned estimate. To create the image, set ENTIREFEED_API_KEY in your environment and run:

uv run nano-banana.py --generate \
  --idempotency-key mug-blue-001 \
  --output mug-blue.png

Type GENERATE at the prompt to submit paid work. Choose a unique idempotency key for each new intended request. Keep that key and the exact inputs if you need to recover from an uncertain response.

The script sends the same body to POST /v1/generations with your Bearer credential and Idempotency-Key header. It then stores the returned generation ID in its printed output, polls GET /v1/generations/{id}, and downloads the first image asset after succeeded. It prints the output URL, MIME type, expiry and usage record. The image download uses a separate request without your API key.

To compare models, run a free estimate first:

uv run nano-banana.py --model nano-banana-2-lite
uv run nano-banana.py --model nano-banana-pro --resolution 2K

Pass the same options when generating and use a new idempotency key for that different request. The API validates combinations: for example, Lite with 4K is not supported.

Check the returned MIME type when naming downloaded files. Our verified Lite result was JPEG, while Nano Banana 2 and Pro returned PNG; use a matching .jpg or .png filename with --output.

Edit an existing image

Use image.edit when the starting image is part of the brief. Give the script the publicly reachable HTTPS output URL from the first generation and describe what should change:

uv run nano-banana.py \
  --edit 'https://YOUR_IMAGE_HOST/mug-blue.png' \
  --prompt 'Change only the mug glaze from cobalt blue to terracotta orange. Preserve the white sun symbol, handle shape, camera angle, ivory background and lighting.'

Replace the example URL with your actual image URL. This command only estimates. Add --generate --idempotency-key mug-orange-001 --output mug-orange.png to create the edit after confirmation.

The editing body uses images rather than reference_images:

{
  "task": "image.edit",
  "model": "nano-banana-2",
  "input": {
    "prompt": "Change only the mug glaze from cobalt blue to terracotta orange. Preserve the white sun symbol, handle shape, camera angle, ivory background and lighting.",
    "images": [{ "url": "https://YOUR_IMAGE_HOST/mug-blue.png" }],
    "aspect_ratio": "1:1",
    "resolution": "1K"
  }
}

Repeat --edit to supply more references, keeping the primary image first. For image.create with visual references, the equivalent input field is reference_images, also an array of URL objects. Local file paths and URLs behind a login will not work as public image references. Each edit is a separate paid request; inspect the result for unintended changes before using it.

What will this cost?

The table above reads the published catalog's rate for one 1K image. Reference inputs within each model's limit are included in that rate, so adding references does not add a separate image-input fee. Increasing resolution changes the rate where supported. Each model links to its calculator for other sizes. Use the free estimate endpoint with your exact model and inputs before creating work.

An estimate is not a reservation or a price lock. Creation reserves balance at the current price, and the generation's usage record reports its billing outcome. Decimal USD responses may display rounded cents; consult billing and usage records when reconciling many small requests. Budget for revisions and discarded outputs as well as the image you keep.

Recover without creating a duplicate

If you have a generation ID, resume it:

uv run nano-banana.py --resume gen_YOUR_GENERATION_ID --output mug-recovered.png

Resume only reads existing work and downloads its result. It does not submit another paid generation. If creation lost its network response before returning an ID, reuse the same idempotency key and unchanged inputs instead of choosing a new key.

The script stops on failed, cancelled or manual_review and prints the error and billing state. If its 15-minute polling window ends, the generation may still be active; resume later. A download failure also calls for resume, not regeneration. Choose a new output filename if the destination already exists.

For application integration, keep the generation ID in your own durable records and follow the generation lifecycle and idempotency guidance. Save successful media before a returned expiry; a generation ID is not a permanent storage strategy.

Put the first image to work

Start with one prompt and a clear review criterion: subject accuracy, composition, readable text or preservation of a specific reference. Once that result is useful, compare a second model on the same brief and record both accepted outputs and total spend. The lowest per-image rate is only one part of the cost of getting an image you can use.

Get your EntireFeed API key, download the Python example, or inspect the Nano Banana 2 pricing calculator before your first request.

Ready to scale?

Explore usage-based pricing for media generation and reusable workflows.

View Pricing
Ask AIGemini Flash

Ask anything about this article