Search

Search HiAPI models, tools, and resources.

Back to blog
Tutorial

Migrating from Nano Banana 2 to 2.1: What Changes in the API

hiapiNano BananaAPI migrationimage editing

Nano Banana 2.1 keeps the same HiAPI task endpoint as Nano Banana 2, so the migration is small in code and meaningful in validation. The required model value changes, the reference-image contract is narrower, and the price display needs to be checked against the live page before a production rollout.

This guide uses the current documented contracts on the Nano Banana 2 model page and the Nano Banana 2.1 model page. The examples show the documented request shape; validate them with a funded test account before switching production traffic.

The smallest code change

Both versions are created as asynchronous tasks:

curl -X POST "https://api.hiapi.ai/v1/tasks" \
  -H "Authorization: Bearer $HIAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-nano-banana-2.1",
    "input": {
      "prompt": "A clean e-commerce product photograph of a minimalist amber glass skincare serum bottle with a black dropper cap, blank unlabeled bottle, centered on a white marble pedestal, soft studio lighting, warm white background, no lettering",
      "resolution": "1K",
      "aspect_ratio": "1:1",
      "output_format": "png"
    }
  }'

For a text-only generation, the important migration is the value of model:

- "model": "nano-banana-2"
+ "model": "gemini-nano-banana-2.1"

The documented endpoint remains POST /v1/tasks. When a request is accepted, the create call returns a task ID for polling or callback handling. Retrieve the finished task, then read the returned output URL according to the current API documentation.

Fields that can stay, and fields to re-check

The 2.1 contract exposes the same practical input group used by the 2 page: prompt, optional image_input, aspect_ratio, resolution, and output_format. The funded smoke test below accepted both the text-only and reference-image forms; continue checking the live contract when rolling out changes.

The reference-image limits changed. The Nano Banana 2 page lists up to 14 references and a 10 MB limit per image. The 2.1 page lists up to 10 references and a 30 MB limit per image. A migration that simply forwards an existing 14-image batch can therefore fail even when the model ID has been updated. Add a client-side check for the new maximum and decide how to reduce or reject oversized batches.

The 2.1 model page does not expose a mask input. Do not add a mask parameter to the migration payload unless a later API contract explicitly documents it. For an edit, send the source image in image_input and describe both the requested change and the details to preserve in prompt.

{
  "model": "gemini-nano-banana-2.1",
  "input": {
    "prompt": "Keep the amber glass serum bottle and black dropper cap from the reference image. Place it on a sunlit wooden bathroom counter beside a folded cream linen towel and eucalyptus, preserving the bottle shape and blank label.",
    "image_input": ["https://static.hiapi.ai/blog/gemini-nano-banana-2-1-ecommerce-product-images/studio.jpg"],
    "resolution": "1K",
    "aspect_ratio": "16:9",
    "output_format": "png"
  }
}

This exact request completed successfully in the funded smoke test. The resulting image is available here. The 2.1 page states that references must be JPEG, PNG, or WebP and that each reference must be no larger than 30 MB.

Pricing needs a live check

The model-page credit tiers checked on 2026-10-16 were 44, 72, and 116 Credits for Nano Banana 2.1 at 1K, 2K, and 4K. Check the live pricing page and model page before budgeting; billing readback is still pending.

Do not bake a promotional or account-specific figure into a migration calculator. During rollout, record the resolution requested, the amount shown before submission, and the amount charged after completion.

Same prompt, two model IDs

To check the migration path, the same 1K, 1:1 prompt was submitted once with each public model ID. Both requests created a task and reached success. The two outputs show different bottle and pedestal details, so this single pair is useful for checking routing and output handling, not for ranking image quality or claiming product identity consistency.

Prompt used for both requests:

A clean e-commerce product photograph of a minimalist amber glass skincare serum bottle with a black dropper cap, blank unlabeled bottle, centered on a white marble pedestal, soft studio lighting, warm white background, no lettering
RouteModel IDResult
Nano Banana 2nano-banana-21K, 1:1, PNG, task completed successfully
Nano Banana 2.1gemini-nano-banana-2.11K, 1:1, PNG, task completed successfully

Nano Banana 2 output from the same 1K prompt

Nano Banana 2.1 output from the same 1K prompt

The practical migration result is that the 2.1 model ID accepts the documented text-to-image task shape and returns an image through the same asynchronous workflow. The image difference in this one sample should be treated as an observation, not a benchmark.

A migration checklist for production adapters

  1. Replace nano-banana-2 with the exact 2.1 ID, gemini-nano-banana-2.1.
  2. Keep the asynchronous POST /v1/tasks flow and existing task status handling.
  3. Validate image_input as an array of public image URLs and cap it at 10 items.
  4. Update the per-image size check from the old 10 MB assumption to the 2.1 page's 30 MB limit.
  5. Keep prompt, aspect_ratio, resolution, and output_format; remove undocumented fields such as mask.
  6. Send one text-only task and one reference edit in a staging account. Save the request, task ID, terminal status, output URL, and billed amount.
  7. Compare the returned image and error behavior with the old route before moving the default model for all users.

Billing and maintenance checks

The text-to-image and image-to-image request shapes, task creation, terminal success, and output URLs were verified in the smoke test above. Billing was not independently read back from a completed task, so use the live pricing page and task record for the production cost check. Recheck the model page before publishing if the contract or limits have changed.

FAQ

Do I need a new endpoint for Nano Banana 2.1?

No endpoint change is documented. Both model pages use POST /v1/tasks; change the model value and validate the payload.

Can I keep using the old nano-banana-2 model ID?

That ID selects Nano Banana 2. It does not select 2.1. Use gemini-nano-banana-2.1 when you intend to route to 2.1.

Can I send 14 reference images after migrating?

The 2.1 model page currently lists a maximum of 10 references. Reduce the batch or reject it before submission.

Does adding a reference image require a separate editing endpoint?

No separate endpoint is shown. Use the same model ID and add image_input, then describe what should change and what must remain unchanged.

Is 2.1 cheaper for every account?

The public page currently shows a lower standard credit figure for each listed resolution, but billing can change and the page may display account or promotion state. Verify the live price and a completed task before making a cost claim.

Try Nano Banana 2.1 in the HiAPI model page.

Generate it with HiAPI

Choose a model, enter your prompt, and see the result.

HiAPI Blog

Related articles

HiAPI

Generate it with HiAPI

Start generating