# gemini-3.1-flash-image-preview

Calls to the model gemini-3.1-flash-image-preview stopped working on June 25, 2026.

On June 25, 2026, the model gemini-3.1-flash-image-preview reached its shutdown date. Requests sent to model gemini-3.1-flash-image-preview fail since that day. This retirement directly affects all calls targeting this preview model identifier.

## The error Gemini API returns once gemini-3.1-flash-image-preview is gone

Once it is closed to new API keys: HTTP 404

```json
{"error":{"code":404,"message":"This model models/gemini-3.1-flash-image-preview is no longer available to new users. Please update your code to use a newer model for the latest features and improvements.","status":"NOT_FOUND"}}
```

Once it is shut down: HTTP 404

```json
{"error":{"code":404,"message":"models/gemini-3.1-flash-image-preview is not found for API version v1beta, or is not supported for generateContent. Call ModelService.ListModels to see the list of available models and their supported methods.","status":"NOT_FOUND"}}
```

## What to use instead

Move to gemini-nano-banana-2.1, which is recommended by Google as the replacement.

- API: Gemini API (generativelanguage.googleapis.com)
- Model: gemini-3.1-flash-image-preview
- Released: February 26, 2026 (models.dev)
- Kind: Model retirement
- Takes effect: June 25, 2026
- Calls after that day: fail
- Calls it hits: `model gemini-3.1-flash-image-preview`
- Source: [Deprecations page](https://ai.google.dev/gemini-api/docs/deprecations)
- Verified: November 6, 2026, against Gemini API's own pages
- Page: https://www.okapi.bot/models/gemini-api/gemini-3.1-flash-image-preview/

## Gemini API's words

> Model: gemini-3.1-flash-image-preview; Release date: February 26, 2026; Shutdown date: June 25, 2026; Recommended replacement: gemini-nano-banana-2.1

Okapi finds the calls this change hits in your repo and opens the pull request with the fix: https://github.com/apps/okapi-agent
