GEMINI LABJP
API — The Interactions API is now generally available and is the default for Google AI Studio, the Gemini API, and the docs, with a toggle back to the legacy formatAGENTS — With GA, the Interactions API schema is stable and adds Managed Agents and background execution — a good moment to revisit how you run long batchesTRANSLATE — Near-real-time speech-to-speech translation across 70+ auto-detected languages is rolling out in the Live API, AI Studio, and the Google Translate appNOTEBOOK — NotebookLM has been renamed Gemini Notebook, now used by over 30 million people and 600,000+ organizationsMODEL — Gemini 3.5 Flash is the newest broadly available release. The flagship Gemini 3.5 Pro is running months behind while its coding ability is improvedSIRI — Apple picked a custom 1.2-trillion-parameter Gemini model to power the rebuilt Siri, shipping with iOS 27 later this yearAPI — The Interactions API is now generally available and is the default for Google AI Studio, the Gemini API, and the docs, with a toggle back to the legacy formatAGENTS — With GA, the Interactions API schema is stable and adds Managed Agents and background execution — a good moment to revisit how you run long batchesTRANSLATE — Near-real-time speech-to-speech translation across 70+ auto-detected languages is rolling out in the Live API, AI Studio, and the Google Translate appNOTEBOOK — NotebookLM has been renamed Gemini Notebook, now used by over 30 million people and 600,000+ organizationsMODEL — Gemini 3.5 Flash is the newest broadly available release. The flagship Gemini 3.5 Pro is running months behind while its coding ability is improvedSIRI — Apple picked a custom 1.2-trillion-parameter Gemini model to power the rebuilt Siri, shipping with iOS 27 later this year
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-api277troubleshooting82error15model-name2gemini-2.5-pro13generativelanguage3

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-07-01
When a Prompt That Worked in AI Studio Quietly Breaks Over the API — Field Notes on Measuring the Difference
A prompt that behaves perfectly in AI Studio returns an empty string or a 404 the moment you call the Gemini API from your own code. Instead of eyeballing the two, here is a small harness that records the config diff plus finish_reason, token usage, and the model name the server actually resolved — so you can isolate the cause by layer.
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.
📚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 →