Nano Banana 2 API: how to call it, how it bills, three models compared
Nano Banana 2 is Google's image generation model, and on FastMetal its model id is google-nano-banana-2. It is billed at a flat rate per image, listed on its model page. Among the image models we serve, it sits toward the more expensive end.
Below: the call, two response quirks that break naive code, and the same prompt run on three image models so you can see what the price difference buys.
Generate one image
Image generation has its own endpoint, /v1/images/generations, separate from chat completions.
curl https://api.fastmetal.ai/v1/images/generations \
-H "Authorization: Bearer $FASTMETAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google-nano-banana-2",
"prompt": "和紙の質感を活かした浮世絵風の錦鯉。藍と朱の配色、力強い墨線",
"n": 1
}'
The prompt is Japanese and goes through as is: "An ukiyo-e style koi on textured washi paper. Indigo and vermilion, bold ink lines." English prompts work the same way.
Gotcha: url is always null
The response shape is the first thing that catches people.
{
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUg...",
"url": null
}
],
"usage": { "total_tokens": 1146, "input_tokens": 26, "output_tokens": 1120 }
}
The image is Base64 in data[0].b64_json, and url is always null. Code written from OpenAI's docs that reads url gets None and fails.
To save the file:
import base64
from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://api.fastmetal.ai/v1")
res = client.images.generate(
model="google-nano-banana-2",
prompt="和紙の質感を活かした浮世絵風の錦鯉。藍と朱の配色、力強い墨線",
n=1,
)
with open("koi.png", "wb") as f:
f.write(base64.b64decode(res.data[0].b64_json))
Gotcha: usage won't tell you what you paid
Here is the usage each of the three models returned for the same prompt (measured 2026-08-31):
| Model | Output tokens |
|---|---|
google-nano-banana-2 | 1,120 |
bytedance-seedream-4.5 | 16,384 |
z-image-turbo | 0 |
All three bill a flat rate per image, and the token counts have nothing to do with it. bytedance-seedream-4.5 reports 14 times the tokens of Nano Banana 2 and still costs less per image; z-image-turbo reports zero.
usage is whatever the upstream API sent back, and it means something different for each model. Count images to estimate cost, and leave usage out of the math.
One prompt, three models
The prompt carries four instructions: the style (ukiyo-e), the material (washi paper), the palette (indigo and vermilion) and the line quality (bold ink lines).
google-nano-banana-2 (19.8 s, 1024×1024)

It picked up all four. The paper has visible fibers and a deckled edge, the indigo swirls and vermilion scales follow the palette, and it even added something like a seal stamp.
bytedance-seedream-4.5 (22.6 s, 2048×2048)

The strongest brushwork of the three, and the only one at 2048×2048, double the others. It reads more like an ink painting on creased paper than a woodblock print, so it drifts from "ukiyo-e". For some uses that is the better picture.
z-image-turbo (4.4 s, 1024×1024)

A clean koi, in watercolor. It ignored ukiyo-e, washi and ink lines; of the four instructions, only the subject came through.
In exchange it is far cheaper per image and about 4.5 times faster. For rough drafts or thumbnails in bulk, where you want a plausible image quickly and in quantity, that speed and price are what matter.
What the comparison shows
Ordered by price, the models differed in how closely they followed instructions, and much less in how good the image looked. The Z-Image Turbo picture is attractive on its own; you only see the misses when you hold it against the prompt.
If the job specifies style and material in detail, Nano Banana 2 earns its rate. If only the subject has to be right, you don't need to pay for it.
Text models won't draw for you
It sounds obvious, and it is a common mistake.
Our comparison corpus sent this koi prompt to 13 models. Three returned an image. The other ten answered in text, all with HTTP 200 and no error. qwen3.8-27b, for example:
画像そのものは生成できませんが、この言葉を画像生成用のプロンプトとして整えました。
("I can't generate the image itself, but I've polished your words into a prompt for an image generator.")
Most offered a cleaned-up prompt; glm-5.3-flash made a real attempt and wrote an SVG. None of them gives you an image file. Check that a model is an image model on /models before you call it.
Next steps
- Image generation faceoff puts Seedream 4.5 and Z-Image Turbo head to head
- Per-image rates are on each model page: Nano Banana 2, Seedream 4.5, Z-Image Turbo; the full catalog is at /models and billing at /pricing
All three models work with the same API key, so the fastest way to decide is to run your own prompt on each.