gemini-2.5-flash-image — Deprecated
- Deprecated
- —
- Shutdown
- 2026-10-02
- Status
- deprecated
- Replacement
- gemini-3.1-flash-image-preview
Quick fix — copy & paste
Choose your language. The "before" block matches the deprecated call; the "after" block is the drop-in replacement.
# Gemini: gemini-2.5-flash-image (deprecated)
model = "gemini-2.5-flash-image" # Replacement
model = "gemini-3.1-flash-image-preview" // Gemini: gemini-2.5-flash-image (deprecated)
const model = "gemini-2.5-flash-image"; // Replacement
const model = "gemini-3.1-flash-image-preview"; "model": "gemini-2.5-flash-image" "model": "gemini-3.1-flash-image-preview" This migration was generated automatically from the model rename. If your code does more than swap a model id, double-check request/response shapes against the official Gemini migration guide.
Error messages
Seeing one of these? You're in the right place.
-
model_not_found: gemini-2.5-flash-image -
The model `gemini-2.5-flash-image` has been deprecated -
The model `gemini-2.5-flash-image` does not exist or you do not have access to it
Replacement options
-
gemini-3.1-flash-image-previewCompare token cost →
Other Gemini deprecations
What this means for your code
gemini-2.5-flash-image is a general-purpose chat model used through the standard messages or chat completions endpoint. Most production traffic on chat models comes from streaming responses, function calling, and tool use. After the shutdown date, every API call returns an error and your app breaks for end users until the model id is updated.
Gemini has scheduled gemini-2.5-flash-image for shutdown on 2026-10-02. That gives you 147 days to migrate. Until then the model still works, but every API call after that date will return a model_not_found error.
Find every call in your codebase
Before you change anything, locate every place the deprecated model id is referenced. Search source files, environment files, feature flags, and config repos. Use these commands from your project root:
Python projects
grep -rn '"gemini-2.5-flash-image"' --include="*.py" . JavaScript / TypeScript projects
grep -rn '"gemini-2.5-flash-image"' --include="*.{js,ts,tsx,jsx}" . Anywhere (configs, scripts, infra)
grep -rn "gemini-2.5-flash-image" . Migration checklist
Steps in order. Skip any that don't apply, but read the whole list — for chat models, the non-obvious steps are usually the ones that break in production.
- 1. Search for the deprecated model id in your application code, environment variables, and feature flags
- 2. Update the model id in your API client configuration
- 3. Re-run integration tests that exercise streaming, function calling, and structured outputs
- 4. If you use prompt caching, verify the new model supports the same cache scopes
- 5. Compare token costs on a representative sample of prompts before deploying
Will this migration cost more?
Switching from gemini-2.5-flash-image to gemini-3.1-flash-image-preview could change your costs significantly. Calculate the exact difference for your prompts.
Open the cost calculator →