Back to Models

Gemini 3.1 Flash Image

googlegoogle/gemini-3.1-flash-image

Google's GA image generation model built on Gemini 3.1 Flash. Supports text and image input/output for creative workflows with conversational multi-turn editing. Replaces gemini-3.1-flash-image-preview.

Gemini 3.1 Flash Image is Google's GA mid-tier Nano Banana image model for teams that need better production quality than the Lite tier without paying Pro-image prices. It accepts text and image inputs and returns text or image outputs, which makes it useful for conversational image creation, reference-guided edits, marketing variants, and iterative design workflows served through TheRouter.

Operationally, this is the balanced routing target in the Gemini image family: use Lite for cheap drafts, this Flash Image model for production-ready balanced jobs, and Gemini 3 Pro Image when precision and professional composition matter more than cost. It also replaced the older gemini-3.1-flash-image-preview ID, so hard-coded preview routes should be retired rather than left as fallbacks.

Best for
  • • Production marketing images, thumbnails, social variants, and ecommerce visuals where balanced quality/cost matters more than the absolute cheapest per-image price
  • • Reference-guided image editing and multi-turn creative refinement that needs text plus image input instead of a one-shot text-to-image endpoint
  • • Routing policies with explicit draft/balanced/pro tiers across Gemini image models
  • • Migration targets for apps still pointing at gemini-3.1-flash-image-preview or older Gemini image endpoints
Reach for something else if
  • • Very high-volume ideation or draft generation where Gemini 3.1 Flash Lite Image is explicitly cheaper and faster enough for the job
  • • Accuracy-critical professional design, dense text layout, or premium brand work where Gemini 3 Pro Image should be the first route
  • • Offline, open-weight, or self-hosted deployments — this is a proprietary hosted Gemini API model served through TheRouter

How TheRouter serves this differently from the vendor

As the vendor operates it

Google’s native Gemini API documents Gemini image models through generateContent and Gemini-specific image-generation guides.

On TheRouter

TheRouter serves the same model ID through an OpenAI-compatible API surface so teams can route it beside other hosted image and multimodal models without calling Google’s native endpoint directly.

Context Length
131K
Max Output
33K
Input Priceper 1M tokens
$0.5494/ 1M tokens
Output Priceper 1M tokens
$65.92/ 1M tokens

Modalities

textimage→textimage

Capabilities

VisionImage Generation

Pricing Breakdown

TypeRate
Input$0.5494 / 1M tokens
Output$65.92 / 1M tokens

Single blended output rate = the image-output rate ($60/MTok). Google also publishes a separate text/thinking output rate of $3/MTok that this schema cannot express, so non-image output tokens are over-billed. Source: ai.google.dev/gemini-api/docs/pricing, read 2026-07-29.

Supported Parameters

temperaturemax_tokenstop_presponse_formatstop

Specifications

Access tierGenerally available replacement for gemini-3.1-flash-image-previewai.google.dev changelog ↗verified
Input / output modalitiesText and image input; text and image outputai.google.dev image generation docs ↗verified
Context window131,072 tokens on TheRouterTheRouter API docs ↗verified
Max output32,768 tokens on TheRouterTheRouter API docs ↗verified
TheRouter blended pricing$0.5494 / 1M input tokens; $65.9232 / 1M output tokensTheRouter API docs ↗verified
Native Google image-output rate$60 / 1M output tokens for image output; Google also publishes a separate text/thinking output rateai.google.dev pricing ↗verified
Supported TheRouter parameterstemperature, max_tokens, top_p, response_format, stopTheRouter API docs ↗verified
LicenseProprietary hosted API model; not open weightsai.google.dev image generation docs ↗verified

Benchmarks

BenchmarkDistributionScoreSource
Public benchmark suite
Google’s public image-generation docs describe capabilities and tiering but do not publish a comparable benchmark table for Gemini 3.1 Flash Image.
—Not publicly disclosed—
Production latency
No funded live verification or latency benchmark was run in this scheduled pass.
—Not publicly disclosed—
Image quality ranking
Google positions this as the balanced Flash Image tier, but no public win-rate or Elo table was available for a defensible numeric score.
—Not publicly disclosed—

API Usage Examples

Use the global api.therouter.ai endpoint shown below for new integrations; the legacy China accelerated endpoint is retired.

Recommended: use the async API

Image generation typically takes 30–180s, beyond the edge sync timeout. The examples below use the ?async=true submit + poll pattern. Read the full async image generation & edit guide →

cURL
# 1) Submit job (returns 202 immediately with a polling URL).
# Image generation takes 30-180s — always use the async path in production.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/generations?async=true"   -H "Content-Type: application/json"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -d '{
    "model": "google/gemini-3.1-flash-image",
    "prompt": "A cinematic product render with soft studio lighting"
  }' | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"

# 2) Poll until terminal (succeeded / failed / cancelled / expired).
while :; do
  R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB"     -H "Authorization: Bearer $THE_ROUTER_API_KEY")
  S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
  echo "status: $S"
  case "$S" in
    succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
    failed|cancelled|expired) echo "$R"; exit 1 ;;
  esac
  sleep 5
done

Multimodal image generation

Send a text prompt to TheRouter’s OpenAI-compatible chat endpoint and request Gemini 3.1 Flash Image when you need a balanced Google image tier.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-image",
    "messages": [
      {
        "role": "user",
        "content": "Create a square product hero image for a ceramic travel mug on a warm studio background."
      }
    ],
    "max_tokens": 1024
  }'

Image Editing Examples

Upload an image and describe the edit you want with a text prompt; the model returns the edited image as base64.

cURL
# Same async submit + poll pattern as /v1/images/generations.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/edits?async=true"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -F "model=google/gemini-3.1-flash-image"   -F "prompt=Turn this scene into a watercolor painting"   -F "size=1024x1024"   -F "image=@input.png" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"

while :; do
  R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB"     -H "Authorization: Bearer $THE_ROUTER_API_KEY")
  S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
  echo "status: $S"
  case "$S" in
    succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
    failed|cancelled|expired) echo "$R"; exit 1 ;;
  esac
  sleep 5
done

More from google

Similar models

Cross-provider sibling models

News & changes

2026-07-08

Nano Banana 2 Lite is your new default Gemini image endpoint — here's the routing decision framework

Google’s Nano Banana family now has clearer Lite, balanced Flash Image, and Pro Image tiers. For TheRouter operators, Gemini 3.1 Flash Image is the balanced branch in that routing policy, while Lite handles drafts and Pro handles premium accuracy-critical work.

re-authored by TheRouterblog.google ↗
2026-06-20

Gemini API Image Generation 2026: Fix Failed to Fetch After Preview Shutdowns

Google’s image preview IDs were replaced by GA Gemini image models. Teams still routing to gemini-3.1-flash-image-preview should move to Gemini 3.1 Flash Image and remove preview strings from fallback chains.

re-authored by TheRouterai.google.dev changelog ↗

Frequently asked

When should I choose Gemini 3.1 Flash Image instead of Lite or Pro?

Use it as the balanced production tier: better suited than Lite for customer-facing assets and cheaper than Pro for jobs that do not need maximum professional precision. Route drafts to Lite and accuracy-critical brand or design work to Pro.

Is google/gemini-3.1-flash-image the replacement for the preview ID?

Yes. Google’s 2026 image deprecation wave moved teams from gemini-3.1-flash-image-preview to the GA gemini-3.1-flash-image model. Production routing tables should use the GA ID and remove preview fallbacks.

re-authored by TheRouterai.google.dev changelog ↗
Were the snippets on this page live-verified?

No. This scheduled curation pass had no paid API budget, so snippets were not executed and no verification ledger record was added. Treat the examples as implementation templates until an operator approves a funded snippet run.

Fact ledger — every claim on this page traces here
sourceURLretrieved
Access tierai.google.dev changelog ↗2026-08-05verified
Input / output modalitiesai.google.dev image generation docs ↗2026-08-05verified
Context windowTheRouter API docs ↗2026-08-05verified
Max outputTheRouter API docs ↗2026-08-05verified
TheRouter blended pricingTheRouter API docs ↗2026-08-05verified
Native Google image-output rateai.google.dev pricing ↗2026-08-05verified
Supported TheRouter parametersTheRouter API docs ↗2026-08-05verified
Licenseai.google.dev image generation docs ↗2026-08-05verified
Public benchmark suiteai.google.dev image generation docs ↗2026-08-05unknown
Production latencyTheRouter API docs ↗2026-08-05unknown
Image quality rankingai.google.dev image generation docs ↗2026-08-05unknown
Nano Banana 2 Lite is your new default Gemini image endpoint — here's the routing decision frameworkblog.google ↗2026-08-05verified
Gemini API Image Generation 2026: Fix Failed to Fetch After Preview Shutdownsai.google.dev changelog ↗2026-08-05verified
When should I choose Gemini 3.1 Flash Image instead of Lite or Pro?ai.google.dev image generation docs ↗2026-08-05to verify
Is google/gemini-3.1-flash-image the replacement for the preview ID?ai.google.dev changelog ↗2026-08-05to verify
Were the snippets on this page live-verified?TheRouter API docs ↗2026-08-05to verify
Help & contact