Google: Nano Banana 2.1: AI model
- Context window:
- 65,536 tokens
- Input:
- $1.5/1M tokens
- Output:
- $7.5/1M tokens
- Type:
- text, image
- Vision
- Tools
- Streaming
Thinking levels: high · minimal
Google: Nano Banana 2.1 is a AI model from Google, available through Hormouz via an OpenAI-compatible API with stable access from inside Iran.
Nano Banana 2.1 (Gemini Nano Banana 2.1) is Google's image generation and editing model on the Flash tier, succeeding Nano Banana 2 and Nano Banana Pro. It improves product recontextualization,...
Quickstart
# The image comes back as a data: URI on message.images, not as text.
URL=$(curl -s https://api.hormouz.net/v1/chat/completions \
-H "Authorization: Bearer ng-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-nano-banana-2.1",
"modalities": ["image", "text"],
"messages": [{"role": "user", "content": "A red apple on a wooden table"}]
}' | jq -r '.choices[0].message.images[0].image_url.url')
# Take the extension from the URI itself — this model may answer png or jpeg.
EXT=$(printf '%s' "$URL" | sed -n 's|^data:image/\([a-z]*\);.*|\1|p')
printf '%s' "$URL" | sed 's/^data:[^,]*,//' | base64 -d > "output.${EXT:-png}"Specs
| Vendor | |
|---|---|
| Type | Text, Image |
| Context window | 65,536 tokens |
| Pricing | $1.50/M in · $7.50/M out |
| API | Chat Completions |
| Capabilities | Streaming · Vision · Tools |
Code example
cURL
# The image comes back as a data: URI on message.images, not as text.
URL=$(curl -s https://api.hormouz.net/v1/chat/completions \
-H "Authorization: Bearer ng-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-nano-banana-2.1",
"modalities": ["image", "text"],
"messages": [{"role": "user", "content": "A red apple on a wooden table"}]
}' | jq -r '.choices[0].message.images[0].image_url.url')
# Take the extension from the URI itself — this model may answer png or jpeg.
EXT=$(printf '%s' "$URL" | sed -n 's|^data:image/\([a-z]*\);.*|\1|p')
printf '%s' "$URL" | sed 's/^data:[^,]*,//' | base64 -d > "output.${EXT:-png}"Python
import base64
from openai import OpenAI
client = OpenAI(api_key="ng-YOUR_API_KEY", base_url="https://api.hormouz.net/v1")
response = client.chat.completions.create(
model="google/gemini-nano-banana-2.1",
messages=[{"role": "user", "content": "A red apple on a wooden table"}],
modalities=["image", "text"],
)
# message.content is None on an image reply — the picture is in message.images.
for i, img in enumerate(response.choices[0].message.images or []):
header, b64 = img["image_url"]["url"].split(",", 1)
ext = "png" if "image/png" in header else "jpg"
with open(f"output_{i}.{ext}", "wb") as f:
f.write(base64.b64decode(b64))JavaScript
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({ apiKey: "ng-YOUR_API_KEY", baseURL: "https://api.hormouz.net/v1" });
const response = await client.chat.completions.create({
model: "google/gemini-nano-banana-2.1",
messages: [{ role: "user", content: "A red apple on a wooden table" }],
modalities: ["image", "text"],
});
// message.content is null on an image reply — the picture is in message.images.
(response.choices[0].message.images ?? []).forEach((img, i) => {
const url = img.image_url.url;
const ext = url.startsWith("data:image/png") ? "png" : "jpg";
fs.writeFileSync(`output_${i}.${ext}`, Buffer.from(url.slice(url.indexOf(",") + 1), "base64"));
});Buy the Google: Nano Banana 2.1 API, paid in rial
- Buy credit with an Iranian bank card; no foreign card or account needed.
- One Hormouz key reaches Google: Nano Banana 2.1 and 600+ other models, and you pay only for what you use.
- No VPN and no risk of a banned account; just change the base URL to api.hormouz.net/v1.
Use via Hormouz
Connect to this model and 600+ others with one API key, then see usage down to each request.
Request company accessUpdated 2026-10-13