The error, verbatim
Jump to the fix ↓{
"error": {
"code": 404,
"message": "This model models/gemini-2.5-flash is no longer available to new users. Please update your code to use models/gemini-3.8-flash for the latest features and improvements. We recommend you to use the Interactions API (https://ai.google.dev/gemini-api/docs/get-started).",
"status": "NOT_FOUND"
}
}
Tested on
- @google/genai
- 2.27.0
- API key
- new, free tier (AI Studio)
- Node / OS
- 24.14.0 / Windows 11 Pro
- Date
- October 7, 2026
Contents
This isn’t your code, and it isn’t your key’s permissions. Google has retired the 2.x models for keys and projects that didn’t use them before. That’s why the same code keeps working on a colleague’s old key and fails on yours, or works on your laptop and fails in a new deployment with a fresh key.
I called every older model name with a brand-new key. There are three different messages, depending on how old the model is:
| Model | Message |
|---|---|
gemini-2.5-flash, gemini-2.5-pro, gemini-2.5-flash-lite |
404 “no longer available to new users” |
gemini-2.0-flash, gemini-2.0-flash-lite |
404 “no longer available” (gone for everyone) |
gemini-1.5-flash, gemini-1.5-pro |
404 “is not found for API version v1beta, or is not supported for generateContent” |
Each 404 for a 2.x model names its own replacement:
| You asked for | The error suggested |
|---|---|
gemini-2.5-flash |
gemini-3.8-flash |
gemini-2.5-pro |
gemini-3.1-pro-preview |
gemini-2.5-flash-lite |
gemini-3.5-flash-lite |
gemini-2.0-flash |
gemini-3.8-flash |
gemini-2.0-flash-lite |
gemini-3.5-flash-lite |
The model list doesn’t warn you
If you check ai.models.list() first, you’ll still find gemini-2.5-flash, gemini-2.5-pro and gemini-2.5-flash-lite in it, listed as supporting generateContent. Then the call 404s. So “it’s in the list” doesn’t mean your key can use it: only a real call tells you.
The fix
Change the model name. These worked with the new free key:
const res = await ai.models.generateContent({
model: 'gemini-3.5-flash', // or 'gemini-3.5-flash-lite'
contents: 'hi',
});To stop this happening at the next retirement, you can use the moving alias instead of a version number. gemini-flash-lite-latest answered, and the response’s modelVersion showed it was serving gemini-3.5-flash-lite:
const res = await ai.models.generateContent({ model: 'gemini-flash-lite-latest', contents: 'hi' });
console.log(res.modelVersion); // gemini-3.5-flash-liteThe cost of an alias: the model behind it changes without notice, so output and pricing can shift under you. Log modelVersion so you can see when it does.
Don’t jump straight to the suggested model
The 404 for gemini-2.5-flash says to use gemini-3.8-flash. Every time I tried it that evening, it returned 503 “This model is currently experiencing high demand” or timed out, and gemini-flash-latest did the same. Meanwhile, older models kept answering. The newest model is the busiest one. Test the replacement before you ship it.
And for the Pro suggestion (gemini-3.1-pro-preview): on the free tier its quota is 0, so switching to it turns your 404 into a 429. That one is covered in Gemini API 429 RESOURCE_EXHAUSTED: why your limit is 0.
What didn’t work
How this was tested
A free Google AI Studio key on October 7, 2026 (a new one: it got the “to new users” 404), with @google/genai 2.27.0 on Node 24.14.0 (Windows 11). Every model was called once with a one-word prompt and maxOutputTokens: 1. The model list came from ai.models.list() with the same key. I didn’t have an older key to confirm that the 2.5 models still work for existing users. That part is what the error message itself says (“to new users”), not something I saw. Google retires models on its own schedule, so check the date above.
The code for every case above is public, so you can run it yourself: gemini-429 in nk-repro.
— N.K., end of entry No.051