Fix Gemini API 404 "models/... is not found for v1beta"
When the Gemini API returns 404 "models/gemini-pro is not found for v1beta", check the name with ListModels, then tell a retired model from an alias.
models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. ...In the official error table this 404 is model_not_found: the model you asked for does not exist. It is not a key or quota problem. The part after models/ is the name the server does not recognize. For rate-limit errors, see Retry Gemini API 429 and 503 Errors with Backoff.
[1] Split the message into a name and a version. Whatever follows models/ is the model you requested; API version v1beta is the version in the URL you called. Forum threads show the same sentence with other values, such as models/gemini-pro-latest is not found for API version v1 and models/gemini-1.5-pro-002 is not found for API version v1beta. Read them the same way.
[2] Ask the server which names are valid now. models.list is GET https://generativelanguage.googleapis.com/v1beta/models and returns 50 models per page by default (1000 at most).
$ curl "https://generativelanguage.googleapis.com/v1beta/models?pageSize=1000" \ -H "x-goog-api-key: $GEMINI_API_KEY"In each entry of models[], read name (format models/{model}) and supportedGenerationMethods. If your call is generateContent, only models whose array contains generateContent qualify. A nextPageToken means more pages exist. In the Python SDK, client.models.list() returns the same list.
[3] Compare the list with the name in your code. The model code is the name minus the models/ prefix. One wrong character in the spelling, the hyphens, or the version number gives a 404.
[4] If the name is not in the list, suspect a retired model. The deprecations page says a shut-down model is "completely turned off, and the endpoint is no longer available", and that the shutdown dates in its table are the earliest possible retirement dates. At the time of writing, gemini-pro was not in that table, so the docs alone give no retirement date for old names like it. Users on the forum report that list_models no longer returns gemini-pro and that they saw a notice that the 1.5 series reached end of life, but those are user posts, not staff answers.
[5] Pick a replacement using the models page naming rules. The docs say models come as stable, preview, latest, or experimental.
| Kind | What the docs say | In your code |
|---|---|---|
| stable | Points to one specific model for production; usually does not change | Use this to pin |
| preview | Usable in production, tighter rate limits, deprecated with notice | Check the deprecations page too |
| latest | An alias hot-swapped to each new release | Only where a model change is acceptable |
| experimental | For testing; endpoints may change | Not for production code |
The docs give these example strings: gemini-3.6-flash for stable, gemini-2.5-flash-preview-09-2025 for preview, and gemini-flash-latest for latest. They also state the naming rules reflect September 2025 and that older models may follow different conventions.
[6] If you still get 404 after renaming, check v1 versus v1beta. The troubleshooting page says a Beta feature is only available in /v1beta. Changing the URL version is worth trying only when the name is right and the feature is Beta; with a wrong name, switching versions does nothing.
[7] Keep the model name in one place. If it is scattered across files, a deprecation notice leaves one copy behind. An environment variable or a config file gives you one line to change.
Check it with the HTTP status codes tool ↗ — calculated in your browser.