Skip to content

nano-banana-2 API — Access via an AI API Gateway

nano-banana-2 is Google's Gemini image model, strong at both generating and editing images, and especially good at multi-reference-image composition (up to 6 images). Call it through byesu — an AI API gateway with an OpenAI-compatible image API: requests are routed to the official model with no quality degradation, billed per image at $0.025 / image, with resolutions spanning 1K / 2K / 4K. The same platform also serves Claude, GPT-5.6, Grok and Gemini text models, pay-as-you-go with no subscription.

This page gives you an integration example you can copy and run directly. Register for the console at byesu.com; the full media API docs are at docs.byesu.com/media.

In one line: what it is and what it costs

  • Model: nano-banana-2 (Google Gemini image) — text-to-image and image-to-image in one, with standout multi-reference composition
  • Price: $0.025 / image, billed per image; 1K / 2K / 4K resolutions are all expressed via the size parameter
  • How to connect: OpenAI-compatible API, Base URL https://byesu.com/v1, with a token in the media / media-gen group

Your token must use the right group

Tokens for image models must belong to the media / media-gen group, otherwise you'll get a "no available channel" error. When creating a token in the console, just pick it from the "Group" dropdown. See Choosing a group for details.

How to call it

Prep: get a token

  1. Open the console and log in → Tokens in the left sidebar → Add token
  2. Set the group to media / media-gen, give it a name, set a quota → submit
  3. Copy the resulting token, which looks like sk-xxxxxxxx

Text-to-image (curl)

Text-to-image goes to POST /v1/images/generations and returns a PNG as base64 synchronously:

bash
curl https://byesu.com/v1/images/generations \
  -H "Authorization: Bearer sk-your-token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nano-banana-2",
    "prompt": "a golden retriever running through a golden wheat field at dusk, cinematic, shallow depth of field",
    "size": "2048x1152"
  }'

Response:

json
{ "data": [ { "b64_json": "<base64 string>" } ] }

Text-to-image (Python)

python
import base64, requests

resp = requests.post(
    "https://byesu.com/v1/images/generations",
    headers={"Authorization": "Bearer sk-your-token"},
    json={
        "model": "nano-banana-2",
        "prompt": "cyberpunk rainy-night street, neon reflections, 4K photorealistic",
        "size": "3840x2160",   # long edge ≈3840 → 4K
    },
).json()

b64 = resp["data"][0]["b64_json"]
open("out.png", "wb").write(base64.b64decode(b64))

Image-to-image / multi-reference composition (nano-banana-2's strength)

Image-to-image goes to POST /v1/images/edits in multipart/form-data format. Reference images are uploaded as files, and the field name image can be repeated to send multiple images (nano-banana-2 caps out at 6 images, each ≤8MB):

bash
curl https://byesu.com/v1/images/edits \
  -H "Authorization: Bearer sk-your-token" \
  -F model="nano-banana-2" \
  -F prompt="composite the people from these three photos into the same seaside scene with unified lighting" \
  -F size="2048x2048" \
  -F image=@person1.png \
  -F image=@person2.png \
  -F image=@scene.png

The response format is the same as text-to-image (data[0].b64_json). In Python, pass multiple images with files=[("image", open(p,"rb")) for p in paths].

Key parameters

ParameterEndpointRequiredNotes
modelbothAlways set to nano-banana-2; casing and hyphen must match exactly
promptbothThe text prompt; spelling out subject + scene + style + lighting works better
sizebothWidth x height in pixels, which sets both the aspect ratio and the resolution tier: long edge ≈1024 → 1K, ≈2048 → 2K, ≈3840 → 4K. E.g. "1024x1024" (1:1 · 1K), "2048x1152" (16:9 · 2K), "3840x2160" (16:9 · 4K). If omitted, defaults to the 1:1 base tier
imageedits onlyReference-image file field, repeatable for multiple images; nano-banana-2 caps at 6 images, each ≤8MB

Billing only counts "images," independent of resolution tier: $0.025 / image. The console shows the actual billed price for each call.

Why use byesu to access nano-banana-2

  • Official model, no quality degradation: requests are routed to the official service — not reverse-engineered, mirrored, or cracked — so output quality matches the official service
  • Transparent per-image pricing: nano-banana-2 at $0.025 / image; the console shows the actual billed price alongside the official list price, and you're only charged for what you use
  • Automatic refunds on failure: if a media task fails to generate, the fee is automatically refunded — you don't pay for junk images
  • Multi-reference friendly: native support for multi-image upload via /v1/images/edits, directly leveraging nano-banana-2's strength of composing from up to 6 reference images
  • One API, every model: the same OpenAI-compatible API also calls other image / video / text models — switching models just means changing the model field
  • Pay-as-you-go, no subscription: top up with USDT, Alipay or WeChat Pay and pay only for the images you generate

FAQ

How do I get nano-banana-2 API access?

Sign up at the byesu console, create a token in the media / media-gen group, and call nano-banana-2 through the OpenAI-compatible /v1/images/generations and /v1/images/edits endpoints with Base URL https://byesu.com/v1. byesu is an AI API gateway — the same platform also serves Claude, GPT-5.6, Grok and Gemini, billed pay-as-you-go with no subscription.

How much does the nano-banana-2 API cost per image?

byesu bills nano-banana-2 at $0.025 per image, billed per image regardless of the resolution tier (1K/2K/4K). Failed generations are automatically refunded, and the console shows the actual billed price for every call.

How do I do multi-reference-image composition with nano-banana-2?

Call POST /v1/images/edits (multipart format) and put each reference image as a file in the image field, which can be repeated to upload multiple images. nano-banana-2 supports up to 6 reference images, each ≤8MB — perfect for compositing multiple people or elements into a single scene.

Can I use nano-banana-2 in Claude Code or a client app?

nano-banana-2 is an image-generation model, called through the /v1/images/generations and /v1/images/edits endpoints rather than the chat API, so it isn't used as a chat model inside Claude Code. You can call it directly with curl/Python, or pick it in byesu's generation workbench. Clients like Claude Code, Codex, and Cherry Studio connect to text/coding models instead.

Which resolutions and aspect ratios does nano-banana-2 support?

It supports three tiers — 1K / 2K / 4K — expressed via the size parameter (width x height in pixels): a long edge of about 1024 is 1K, about 2048 is 2K, and about 3840 is 4K. Common aspect ratios include 1:1, 16:9, 9:16, 4:3, and 3:4 — for example, 2048x1152 is 16:9 at 2K.

What do I do if calling nano-banana-2 returns "no available channel"?

It's almost always a wrong token group. Tokens for image models must belong to the media / media-gen group. Create a new token in that group in the console, and make sure model is set to nano-banana-2 (matching casing and hyphen), and the error goes away.

Got a problem? Contact support or join our group.