Python API call to Gemini Pro (gemini-pro) incorrectly routes to v1beta, causing 404 error
10:34 10 Dec 2025

I'm facing a persistent and unusual issue with the Generative Language API. Despite trying every possible solution I can think of, my API calls from a Python script to the `gemini-pro` model are consistently resulting in a 404 error, seemingly because they are being routed to an old `v1beta` endpoint.

**The Goal:**

To call the `gemini-pro` model from a Python script using the `google-generativeai` library.

**The Problem:**

The API call always fails with the following 404 error message, indicating it's trying to use the `v1beta` API version:

404 models/gemini-pro is not found for API version v1beta, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods.

**Troubleshooting Steps Taken:**

I have exhaustively tried the following steps, but the situation has not changed at all:

1. **Clean Python Environment:** Performed a complete, clean installation of Python on the local machine.

2. **Latest Library:** Ensured the `google-generativeai` library is updated to the latest version.

3. **Activated GCP Project:** Activated the Google Cloud Platform free trial and successfully registered billing information.

4. **Enabled API:** Confirmed that the "Generative Language API" is marked as "Enabled" in the GCP console for the project.

5. **New API Key:** Generated a completely new API key within the activated GCP project and used it in the script.

6. **New GCP Project:** Created a second, entirely new GCP project from scratch, enabled the API, and generated another new API key, which still resulted in the same error.

7. **Code Verification:** The issue occurs with a very simple, standard Python script. The same error also occurred when running the code in a Google Colab notebook, suggesting the issue is not specific to my local machine's environment.

**The Question:**

Given that all of the above steps have failed, what could possibly be causing my API calls to be routed to the `v1beta` endpoint?

It seems like this might be an account-specific issue that is forcing my requests to use an outdated API version, regardless of the project or API key. Has anyone ever encountered such a problem, or can anyone suggest what might be happening at the account level?

Any help or insight would be greatly appreciated. Thank you.

google-cloud-platform google-api-python-client google-gemini