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 (
.orgdomain)
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:
-
API Key: Verified valid. Read correctly by the server.
-
API Activation: “Generative Language API” is explicitly enabled in the Google Cloud Console for the specific project.
-
Project Context: Tried both an existing project and creating a brand new project via Google AI Studio.
-
Models Tested: Tried
gemini-1.5-flash,gemini-1.5-flash-latest, andgemini-pro. All return 404. -
Cache: Deleted
.nextfolder and performed clean installs. -
Browser Direct Call: Calling the models list via
https://generativelanguage.googleapis.com/v1beta/models?key=MY_KEYreturns 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?