Persistent 404 Error for gemini-1.5-flash via Generative Language API (Next.js SDK)

I am consistently receiving a 404 error when trying to access gemini-1.5-flash using the @google/generative-ai SDK in a Next.js environment. Despite verified configuration, the model is reported as “not found”.

Technical Details:

  • SDK: @google/generative-ai (latest)

  • Environment: Node.js (Next.js 14/15)

  • Endpoint called by SDK: https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent

  • Region: France (EU)

  • Account Type: Google Workspace account (.org domain)

The Error Log:

Plaintext

[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [404 Not Found] models/gemini-1.5-flash is not found for API version v1beta, or is not supported for generateContent.

Steps Already Taken:

  1. API Key: Verified valid. Read correctly by the server.

  2. API Activation: “Generative Language API” is explicitly enabled in the Google Cloud Console for the specific project.

  3. Project Context: Tried both an existing project and creating a brand new project via Google AI Studio.

  4. Models Tested: Tried gemini-1.5-flash, gemini-1.5-flash-latest, and gemini-pro. All return 404.

  5. Cache: Deleted .next folder and performed clean installs.

  6. Browser Direct Call: Calling the models list via https://generativelanguage.googleapis.com/v1beta/models?key=MY_KEY returns an empty list or doesn’t show the flash models.

Additional Context: The project is currently listed under “No Organization” but the user account belongs to a Workspace domain. There seems to be a disconnect between the API being “Enabled” in the console and the models actually being provisioned for the API key.

Is there a known propagation delay or a specific regional restriction for Workspace-linked projects in France using the Generative Language endpoint?