Skip to content
NEWNano Banana 2.1 is live — Google's latest image model, from $0.0336 per image, native 4K, about half the price of the previous generationView model
HopBase
← Back to blog

Nano Banana 2.1 API: From $0.0336 per Image, 4K Support | HopBase

Nano Banana 2.1 (model ID gemini-nano-banana-2.1) is now live on HopBase. It is Google's latest efficient image generation and editing model, and Google highlights three improvements: visual quality, typography, and multi-turn consistency. For integrators, two changes matter most: each image costs about half as much as on the previous Nano Banana 2 ($0.0336 per 1K image), and native 4K output. Any key bound to the "Gemini (all models, incl. image)" or "Gemini Official Direct" group can call it right away, with the same base URL https://api.hop-base.com.

What changed vs. Nano Banana 2

ItemNano Banana 2
gemini-3.1-flash-image
Nano Banana 2.1
gemini-nano-banana-2.1
1K per image$0.0672$0.0336 (half)
2K per image$0.0672$0.0504
4KNot supported (2K max)$0.113 per image
Image output$60 / 1M tokens$30 / 1M tokens
Input$0.50 / 1M tokens$1.50 / 1M tokens

The price drop comes from the image output rate being cut in half. The input rate actually went up, so edits with many reference images save less than plain text-to-image: the more and larger the reference images, the bigger the input share. For text-to-image and edits with only a few references, "about half the price per image" is a good estimate.

Pricing (official list price)

ItemList price
Input (text / image)$1.50 / 1M tokens
Text and thinking output$7.50 / 1M tokens
Image output$30 / 1M tokens
Cache read$0.075 / 1M tokens
Per image 1K / 2K / 4K$0.0336 / $0.0504 / $0.113

These are Google's list prices. Your actual rate depends on your group and is shown in the Model Plaza after you sign in; the console usage log shows the charge for every request.

Sizes, aspect ratios and speed

  • Three tiers: 1K, 2K and 4K. A 16:9 image at 4K measured 5504 × 3072.
  • 10 official aspect ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9.
  • Typical latency (measured server-side): about 10–15 s at 1K, about 20 s at 2K, about 30–57 s at 4K.

For 2K / 4K images we recommend adding the header Prefer: respond-async: you get a task_id immediately and poll GET /v1/images/tasks?task_id=…, so long requests are not cut off by client or network timeouts.

Get started in three minutes

1. curl: text-to-image with aspect ratio and tier

curl https://api.hop-base.com/v1/images/generations \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-nano-banana-2.1",
    "prompt": "Coffee shop poster for a new drink, headline text \"Autumn Latte\", warm tones, magazine layout",
    "google": {
      "image_config": { "aspect_ratio": "3:4", "image_size": "2K" }
    }
  }' \
  | jq -r '.data[0].b64_json' | base64 --decode > result.png

You can also pass "aspect_ratio" / "image_size" as flat top-level fields with the same effect. If you only send size (e.g. "2048x1152"), the gateway maps it to the nearest official aspect ratio and derives the tier from the longer side.

2. OpenAI Python SDK

import base64
from openai import OpenAI

client = OpenAI(
    base_url="https://api.hop-base.com/v1",
    api_key="sk-your-key",
)

resp = client.images.generate(
    model="gemini-nano-banana-2.1",
    prompt="A convenience store on a rainy neon street corner, sign reads OPEN 24H, cinematic",
    extra_body={
        "google": {
            "image_config": {"aspect_ratio": "16:9", "image_size": "4K"}
        }
    },
)

item = resp.data[0]
# The result may be JPEG; pick the extension from mime_type
ext = "jpg" if getattr(item, "mime_type", "") == "image/jpeg" else "png"
with open(f"result.{ext}", "wb") as f:
    f.write(base64.b64decode(item.b64_json))

3. Generate images from Chat Completions

Clients such as Cherry Studio that only speak the chat API can simply select gemini-nano-banana-2.1; the image comes back as a markdown-embedded data URL:

curl https://api.hop-base.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-nano-banana-2.1",
    "messages": [
      {"role": "user", "content": "A shiba inu wearing a scarf, watercolor style"}
    ]
  }'

For precise control over aspect ratio and tier, use the Images API above.

Editing with reference images

Both groups accept reference images (URL or data URL) in the image / images field of /v1/images/generations. The "Gemini (all models, incl. image)" group also offers the OpenAI-compatible /v1/images/edits, so you can upload local files directly:

curl https://api.hop-base.com/v1/images/edits \
  -H "Authorization: Bearer sk-your-key" \
  -F "model=gemini-nano-banana-2.1" \
  -F "prompt=Recolor the cup using the palette from the second image, keep everything else unchanged" \
  -F "image[][email protected]" \
  -F "image[][email protected]" \
  -F "aspect_ratio=1:1" \
  -F "image_size=2K"

Which group to use

GroupEndpoints
Gemini (all models, incl. image)/v1/images/generations, /v1/images/edits, /v1/chat/completions
Gemini Official Direct/v1/images/generations, /v1/chat/completions (for edits, pass reference images to generations)

Both groups bill at the official price times the group's discount; see the Model Plaza in the console for each group's discount. Before sending paid requests, call GET /v1/models with the key you will actually use and confirm gemini-nano-banana-2.1 is listed.

Good fits

  • High-volume generation: e-commerce product shots, social media visuals, A/B creatives. Half the cost per image adds up quickly at scale.
  • Designs with text: posters, covers, info cards. Typography is a headline improvement in this generation, though we still recommend proofreading rendered text.
  • Multi-turn editing: refine details on top of the previous result; Google emphasizes multi-turn consistency.
  • High-resolution delivery: when you need 4K for print or large screens, there is no need to switch to a pricier model.

FAQ

Is the API the same as Nano Banana 2?

Yes. Request structure, parameters and response format are unchanged; just set model to gemini-nano-banana-2.1. If you were capped at 2K before, you can now set image_size to 4K.

Can I generate several images per request?

Yes, use n; the gateway generates them in parallel. It is all-or-nothing: if any image fails, the whole request fails and is not charged. Large sizes such as 4K have a lower cap on n, and exceeding it returns 400.

Are transparent backgrounds or masked inpainting supported?

No. background: "transparent" and mask both return 400; describe the region you want to change in the prompt instead.

Am I charged for failures?

No. Validation errors and failed generations are free. Only requests that deliver images are charged, and the synchronous response reports the actual charge in usage.cost_usd.

What format are the results?

The Images API returns data[].b64_json synchronously, possibly as JPEG, so check data[].mime_type before saving. Async tasks return an image URL on completion; download it to your own storage promptly.