GEMINI LABJP
FLASH3.5 — Gemini 3.5 Flash reaches general availability for sustained frontier performance on agentic and coding tasks (Jun)MANAGED-AGENTS — Managed Agents launch in public preview on the Gemini API, running in secure Google-hosted Linux sandboxes (Jun)ANTIGRAVITY-AGENT — A general-purpose Antigravity Agent ships in public preview, autonomously planning, coding, managing files, and browsing the web (Jun)SCHEMA — The Interactions API schema moves from outputs to steps; the legacy schema is removed on Jun 8 (Jun)DEPRECATION — gemini-3.1-flash-image-preview and gemini-3-pro-image-preview shut down on Jun 25 (Jun)FILESEARCH — File Search adds multimodal support via gemini-embedding-2, plus event-driven webhooks (Jun)FLASH3.5 — Gemini 3.5 Flash reaches general availability for sustained frontier performance on agentic and coding tasks (Jun)MANAGED-AGENTS — Managed Agents launch in public preview on the Gemini API, running in secure Google-hosted Linux sandboxes (Jun)ANTIGRAVITY-AGENT — A general-purpose Antigravity Agent ships in public preview, autonomously planning, coding, managing files, and browsing the web (Jun)SCHEMA — The Interactions API schema moves from outputs to steps; the legacy schema is removed on Jun 8 (Jun)DEPRECATION — gemini-3.1-flash-image-preview and gemini-3-pro-image-preview shut down on Jun 25 (Jun)FILESEARCH — File Search adds multimodal support via gemini-embedding-2, plus event-driven webhooks (Jun)
Articles/API / SDK
API / SDK/2026-04-12Beginner

Fixing Gemini API 'Model Not Found' Errors: A Complete 2026 Guide

Getting a 'model not found' or INVALID_ARGUMENT error in the Gemini API? This guide explains every cause and fix, including correct model names for 2026 and how to use generativelanguage.googleapis.com properly.

gemini-api299troubleshooting119error23model-name2gemini-2.5-pro20generativelanguage5

If you've been staring at an error like this for the past hour, you're not alone:

404 models/gemini-pro is not found
INVALID_ARGUMENT: model not found: models/gemini-2.5-pro
400 Request contains an invalid argument

Google regularly releases new models and retires old ones — and the Gemini 2.5 Pro / Gemini 3 series transition in 2026 has tripped up a lot of developers. In the vast majority of cases, the culprit is an incorrect model name, not a bug in your code.

Why Does This Error Happen?

There are three main reasons you'll see a model-not-found error:

① You're using a deprecated model name

gemini-pro and gemini-1.0-pro were retired at the end of 2025. Older tutorials and Stack Overflow answers still reference these names, so copying them verbatim will immediately break.

② Your model name format is wrong

There's a meaningful difference between gemini-2.5-pro, gemini-2.5-pro-latest, and gemini-2.5-pro-preview-06-05 — and only the latter two actually work. The bare name without a suffix (gemini-2.5-pro) is not a valid identifier on generativelanguage.googleapis.com.

③ You're calling a model that isn't available on Google AI

Some models (custom-tuned models, certain enterprise variants) are only accessible through Vertex AI and will return a 404 when called via the standard Google AI endpoint.

Valid Model Names for 2026

Here's a quick reference for model names that work with the Google AI API (generativelanguage.googleapis.com) as of April 2026:

Gemini 2.5 Series (Stable)

  • gemini-2.5-pro-latest — Latest stable Gemini 2.5 Pro (recommended for production)
  • gemini-2.5-pro-preview-06-05 — Preview with experimental features
  • gemini-2.5-flash-latest — Latest stable Gemini 2.5 Flash (fast and cost-effective)
  • gemini-2.5-flash-preview-05-20 — Flash preview

Gemini 3 Series (Newest)

  • gemini-3-pro-latest — Latest Gemini 3 Pro
  • gemini-3-flash-latest — Latest Gemini 3 Flash
  • gemini-3.1-pro-latest — Latest Gemini 3.1 Pro
  • gemini-3.1-flash-latest — Latest Gemini 3.1 Flash

Deprecated / Unavailable

  • gemini-pro — Retired
  • gemini-1.0-pro — Retired
  • gemini-1.5-pro-001 — Retired (use gemini-2.5-pro-latest)

Quick rule of thumb: When in doubt, use gemini-2.5-pro-latest (best quality) or gemini-2.5-flash-latest (faster, cheaper). The -latest suffix always points to the most recent stable version of that series.

How to List Available Models Programmatically

If you're unsure what's available in your account, check it directly — this is the most reliable approach.

Python SDK

import google.generativeai as genai
 
# Replace YOUR_API_KEY with your actual key
genai.configure(api_key="YOUR_API_KEY")
 
# List all models that support content generation
for model in genai.list_models():
    if "generateContent" in model.supported_generation_methods:
        print(f"Name: {model.name}")
        print(f"  Display: {model.display_name}")
        print()

If a model name doesn't appear in this output, calling it will return a model not found error.

REST API (curl)

# Replace YOUR_API_KEY with your actual key
curl "https://generativelanguage.googleapis.com/v1beta/models?key=YOUR_API_KEY" \
  | python3 -m json.tool | grep '"name"'

Node.js (@google/genai)

import { GoogleGenAI } from "@google/genai";
 
// Replace YOUR_API_KEY with your actual key
const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY" });
 
const models = await ai.models.list();
for await (const model of models) {
  console.log(model.name);
}

Step-by-Step Fixes for Common Error Messages

Error: 404 models/gemini-pro is not found

Cause: gemini-pro was deprecated and removed.

Fix: Swap in a current model name:

# Old code — will error
model = genai.GenerativeModel("gemini-pro")
 
# Fixed
model = genai.GenerativeModel("gemini-2.5-flash-latest")

Choosing a replacement:

  • Need best accuracy? → gemini-2.5-pro-latest
  • Want low latency and lower cost? → gemini-2.5-flash-latest
  • Building a real-time app? → gemini-3.1-flash-latest

Error: INVALID_ARGUMENT: model not found: models/gemini-2.5-pro

Cause: gemini-2.5-pro (without a version suffix) is not a valid identifier.

# Wrong
model = genai.GenerativeModel("gemini-2.5-pro")
 
# Correct
model = genai.GenerativeModel("gemini-2.5-pro-latest")

The same applies when calling the REST API directly:

# Wrong
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent?key=YOUR_API_KEY"
 
# Correct
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro-latest:generateContent?key=YOUR_API_KEY"

Error: 404 model not supported for generateContent

Cause: You're requesting a model that only exists on Vertex AI, not the Google AI API.

Fix: Either switch to a model listed by list_models(), or migrate to Vertex AI. For Vertex AI authentication setup, see Fixing Vertex AI Gemini Authentication Errors: Service Account and ADC.

Watching Out for Old SDK vs New SDK Confusion

The Python ecosystem has two Gemini SDKs and they look similar enough to cause real confusion. Make sure you're not mixing code from both:

# Old SDK: google-generativeai
import google.generativeai as genai
genai.configure(api_key="YOUR_API_KEY")
model = genai.GenerativeModel("gemini-2.5-pro-latest")
response = model.generate_content("Hello\!")
print(response.text)
 
# New SDK: google-genai (recommended going forward)
from google import genai as newgenai
client = newgenai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
    model="gemini-2.5-pro-latest",
    contents="Hello\!"
)
print(response.text)

Both SDKs accept the same model name format (gemini-2.5-pro-latest). For help with installation conflicts or version issues, see Resolving Gemini API SDK Version and Installation Errors.

Looking back

"Model not found" errors in the Gemini API almost always come down to the model name. Here's the short version: gemini-pro and gemini-1.0-pro are gone, so stop using them. Always include a version suffix — gemini-2.5-pro-latest, not gemini-2.5-pro. Use list_models() or the REST endpoint to see exactly what's available to you. Avoid preview versions in production; use -latest for stability. And double-check which SDK you're using (google-generativeai vs google-genai) since the API signatures differ between them.

Once you have the right model name, most of these errors disappear instantly. If you're still seeing issues after updating the name, the problem may be authentication — see Gemini API Authentication Error Solutions for next steps.

Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

API / SDK2026-04-10
Gemini 2.5 Pro API: Complete Production Troubleshooting & Optimization Guide
Master Gemini 2.5 Pro API for production. Complete error code reference, model configuration, streaming patterns, cost optimization, and load balancing strategies for stable, scalable deployments at generativelanguage.googleapis.com.
API / SDK2026-05-31
Why Gemini API Throws 'Unsupported MIME type' and How to Fix It
The 'Unsupported MIME type' error from the Gemini API has three distinct causes: a misspelled MIME string, an octet-stream upload, and a genuinely unsupported format. Here is how to tell them apart with code that actually works.
API / SDK2026-05-30
Why Gemini 2.5 Pro Rejects thinkingBudget: 0 (and How to Fix It)
Setting thinkingBudget to 0 on Gemini 2.5 Pro returns a 400 INVALID_ARGUMENT error. Here is why the per-model thinking budget ranges differ, how to minimize thinking on Pro the right way, and when to switch to Flash, with Python and JavaScript examples.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →