Gemini API says the model is not found for gemini-1.5-pro or gemini-1.5-flash
Model not found when using gemini 1.5Short answer
Google shut down gemini-1.5-pro, gemini-1.5-flash and gemini-1.5-flash-8b on 29 September 2025, so the API no longer finds them, whatever access you have. Replace the model string with a current model ID from the Gemini models page, and check the deprecation table for the shutdown date of the one you pick.
Fix it fast
1Find out which cause you have
Search the project for every model string. Old IDs hide in config files, env vars and default arguments.
grep -rn "gemini-" src/ .env* 2>/dev/null2Match what you see, then jump to its fix
- 1
The ID in the error is gemini-1.5-pro, gemini-1.5-flash or gemini-1.5-flash-8bThe Gemini 1.5 models are shut downFix - 2
You switched to gemini-2.0-flash or gemini-2.5-flash and the same error returnsThe replacement you chose is shut down tooFix - 3
The code worked for months, then a fixed model string started failingA pinned model ID goes stale again laterFix
- 1
What does the error look like?
Model not found when using gemini 1.5models/gemini-1.5-flash is not found for API version v1beta
Cause 1 of 3
The Gemini 1.5 models are shut down
1Check
The Gemini API changelog lists these three models as shut down on September 29, 2025. Having had access to them before does not change that.
grep -rn "gemini-1.5" src/ .env* 2>/dev/null2Fix
Move to a current model ID from the models page. At the time of writing it lists gemini-3.8-flash and gemini-3.6-flash as stable. Read the page again when you update.
const model = process.env.GEMINI_MODEL ?? 'gemini-3.8-flash';3Verify
Send one short request with the new ID.
GEMINI_MODEL=gemini-3.8-flash node ask.mjs "Say hello"Confirmed by aistudio.google.com
Cause 2 of 3
The replacement you chose is shut down too
1Check
The deprecation table gives gemini-2.0-flash and gemini-2.0-flash-lite a shutdown date of June 1, 2026, and gemini-2.5-flash and gemini-2.5-pro a date of December 1, 2026.
grep -rn "gemini-2" src/ .env* 2>/dev/null2Fix
Pick a model without a near shutdown date. The table names a replacement for each retired ID.
// from the deprecation table:
// gemini-2.0-flash -> gemini-3.6-flash
const model = 'gemini-3.6-flash';3Verify
Run the request again.
node ask.mjs "Say hello"Confirmed by aistudio.google.com
Cause 3 of 3
A pinned model ID goes stale again later
1Check
The models page describes latest aliases such as gemini-flash-latest, which move to a new version when Google releases one, with a 2-week email notice before the underlying version changes.
grep -rn "latest" src/ .env* 2>/dev/null2Fix
Use an alias if you want to follow releases, and read the notice emails. Use a pinned ID if you need identical behaviour, and keep a calendar note for its shutdown date.
const model = 'gemini-flash-latest';3Verify
Run the request and log which model you asked for.
node ask.mjs "Say hello"Confirmed by aistudio.google.com
How do I stop it coming back?
- Keep the model ID in one environment variable, not in many files.
- Check the deprecation page before each release, and note the shutdown dates of models you use.
- Add a startup test that sends one tiny request, so a retired model fails in CI and not for users.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
AI
The model's reply breaks JSON.parse
SyntaxError: Unterminated string in JSON at position 1874
JSON.parse rejects model output for a few repeatable reasons: the JSON sits inside markdown fences or next to a sentence, the reply stopped at the token limit mid-object, a stream was parsed before it ended, or the model refused.
5 causes, each with a fixAI
The OpenAI Node client in Next.js cannot find OPENAI_API_KEY
either provide it, or instantiate the OpenAI client with an apiKey option
The OpenAI client reads process.env.OPENAI_API_KEY when you create it.
3 causes, each with a fixAI
The OpenAI API answers 429: out of credit, or just too fast?
"type": "insufficient_quota"
A 429 from the OpenAI API means one of two unrelated things.
5 causes, each with a fixAI
OpenAI API 400: image_url is only supported by certain models
BadRequestError: 400 Invalid content type. image_url is only supported by certain models.
The request carried an image part, but the model you named cannot take image input.
2 causes, each with a fixAI
Azure OpenAI says the API deployment for this resource does not exist
The API deployment for this resource does not exist
Azure OpenAI does not take a model name in the model field.
2 causes, each with a fixAI
Azure OpenAI fails with an SSL certificate verification error
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED]
The client checks the endpoint's certificate against its CA bundle, which is certifi by default.
2 causes, each with a fix