Hi,
I’m trying to use the Gemini API from my web app and I’m always getting 404 errors for the models, even though the API is enabled.
Project details:
-
API: Gemini API / Generative Language API (
generativelanguage.googleapis.com) -
Billing: Enabled
-
Credentials: Gemini API Key created in this project
Request I’m making from the frontend:
text
**POST https://generativelanguage.googleapis.com/v1/models/gemini-1.5-flash:generateContent?key=MY_API_KEY
Content-Type: application/json
{
"contents": [
{
"parts": [
{
"text": "Test prompt"
}
]
}
]
}**
The response is always:
json
{
"error": {
"code": 404,
"status": "NOT_FOUND",
"message": "models/gemini-1.5-flash is not found for API version v1, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods."
}
}
I see the same 404 behavior when I try gemini-1.5-flash-001.
In the Google Cloud Console:
-
Gemini API is enabled for this project.
-
I can see “Gemini API Key” listed under APIs & Services → Credentials.
-
The same API key is being used in my app (environment variable).
Could you please check why this project cannot access Gemini models (gemini-1.5-flash) and what I should change so that the GenerateContent calls work?
Thanks in advance!