Hormouz AIHormouzSign in

Google: Nano Banana 2 (Gemini 3.1 Flash Image Preview): AI model

Gemini 3.1 Flash Image Preview is a Google image generation and editing model that turns prompts and reference images into new visuals. Served asynchronously through Hormouz.

Context window:
65,536 tokens
Input:
$0.5/1M tokens
Output:
$3/1M tokens
Type:
text, image
  • Vision
  • Streaming

Thinking levels: high · minimal

Gemini 3.1 Flash Image Preview is a Google image generation and editing model. It produces new images from text prompts and can edit or combine reference images while keeping the requested composition, subjects and style. It accepts images and text as input and returns generated images.

Image requests run asynchronously: you submit a prediction and then poll for the result, which fits longer-running generation and batch workloads. Typical uses include product visuals, marketing creative, illustration, and iterative edit-and-refine workflows.

Pricing is usage-based at $0.5/M in · $3/M out · $60/M image-output tokens. Gemini 3.1 Flash Image Preview is served through Hormouz behind an asynchronous predictions API, with stable access from inside Iran.

Gemini 3.1 Flash Image Preview, a.k.a. "Nano Banana 2," is Google’s latest state of the art image generation and editing model, delivering Pro-level visual quality at Flash speed. It combines...

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-3.1-flash-image-preview",
    "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

VendorGoogle
TypeText, Image
Context window65,536 tokens
Pricing$0.50/M in · $3.00/M out
APIChat Completions
CapabilitiesStreaming · Vision
Graphic Design
Top 25%
1,264Elo
Win rate: 66.3%Avg time: 22.6s
Image
Top 25%
1,279Elo
Win rate: 65.1%Avg time: 23.8s
Logo
Top 25%
1,264Elo
Win rate: 62.9%Avg time: 22.2s

Metrics sourced from Design Arena

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-3.1-flash-image-preview",
    "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-3.1-flash-image-preview",
    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-3.1-flash-image-preview",
  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 (Gemini 3.1 Flash Image Preview) 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 (Gemini 3.1 Flash Image Preview) 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.
Create an accountBuy Gemini API access, paid in rial

Use via Hormouz

Connect to this model and 600+ others with one API key, then see usage down to each request.

Request company access

FAQ

What does Gemini 3.1 Flash Image Preview produce?
It generates and edits images from images and text. Requests run asynchronously via the predictions API. Submit, then poll for the result.
What is the context window of Gemini 3.1 Flash Image Preview?
Up to 131K tokens, suitable for long documents and multi-turn conversations.
How much does Gemini 3.1 Flash Image Preview cost?
Usage-based pricing: $0.5/M in · $3/M out · $60/M image-output tokens.
What is Gemini 3.1 Flash Image Preview good for?
Product visuals, marketing creative, illustration, and iterative image edits where you refine a result across turns.
How do I access Gemini 3.1 Flash Image Preview from inside Iran?
Create an account on Hormouz and generate an API key. Hormouz provides stable access from inside Iran via an asynchronous predictions API.

Updated 2026-10-13