Hello,
I’m getting a consistent HTTP 403 from the Gemini API (generativelanguage.googleapis.com) when calling generateContent, but only when the request originates from my cloud host. The same request with the same API key succeeds from my home/residential IP.
Details:
- Endpoint:
POST https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent - Key type: API key created in Google AI Studio (free tier), project [your project name / number]
- Response: HTTP 403 with the generic Google HTML error page (“Your client does not have permission to get URL … from this server”), not a JSON API error.
- Affects all models I’ve tried:
gemini-3.1-flash-lite,gemini-2.5-flash,gemini-2.5-flash-lite,gemini-2.0-flash-lite— all fail identically.
What I’ve isolated:
- From my home/residential IP, the exact same
generateContentrequest with the same key returns HTTP 200 and a valid response. - From my cloud host (Render.com, datacenter IP), the same request returns the HTML 403.
GET .../v1beta/models?key=...(ListModels) returns HTTP 200 from both locations — so the key itself is valid and authenticated; onlyPOST generateContentfrom the datacenter IP is rejected.- The API key has no application/IP restrictions configured in the Cloud Console (Application restrictions = None).
This points to the request being rejected at Google’s frontend based on the source IP / datacenter range, before reaching the API, rather than a key, quota, or request-payload issue.
My questions:
- Is the free-tier Gemini API key endpoint blocked or restricted for requests originating from cloud-provider IP ranges (e.g. Render)?
- If so, what is the supported way to call Gemini from a server-side backend hosted on a cloud provider — should I be using a different endpoint or auth method (e.g. Vertex AI)?
- Is there anything I can configure on the key or project to allow datacenter-origin requests?
Thanks for your help.