Hi,
My Google account is currently unable to generate standard AIza... API keys in Google AI Studio. Every key I create — across all of my Google Cloud projects — is issued only in the new AQ.Ab8... token format.
These AQ. tokens do not work against the Generative Language REST API. When I call the endpoint: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
I receive the following error, regardless of whether I send the credential via the x-goog-api-key header or as an Authorization: Bearer token
401 UNAUTHENTICATED
"Request had invalid authentication credentials. Expected OAuth 2 access token,
login cookie or other valid authentication credential."
reason: API_KEY_SERVICE_BLOCKED
service: generativelanguage.googleapis.com
method: google.ai.generativelanguage.v1beta.GenerativeService.GenerateContent
What I have already tried:
-
Creating new keys in several different Google Cloud projects — all produce
AQ.tokens only. -
Sending the token as
x-goog-api-key(correct forAIzakeys) → 401. -
Sending the token as
Authorization: Bearer→ still 401 withAPI_KEY_SERVICE_BLOCKED.
I need a standard AIza... API key to use the Gemini API from a local Python tool (direct REST calls). Could you please review my account and restore the ability to generate AIza-format keys, or advise on the correct way to authenticate the AQ. tokens against the generativelanguage.googleapis.com endpoint?
Thank you very much for your help.