Project ID: [AZM PROJECT]
Account created: [“2026”]
Key type: Auth key (AQ. prefix) — this is the only type AI Studio will issue for new keys on this account; regenerating the key multiple times has not produced a Standard/AIza key.
What I’ve tried, all failing identically with the same error:
client.models.generate_content(model="gemini-2.5-flash", contents="Hello")via thegoogle-genaiPython SDKclient.interactions.create(model="gemini-3.5-flash", input="Hello")via the same SDK (the newer Interactions API)- Confirmed
pip install --upgrade google-genaito the latest SDK version before retesting - Regenerated the API key 3 times — always issued as
AQ.prefix, neverAIza - Confirmed via AI Studio that the Generative Language API is enabled on the project
Exact error (same reason code across all attempts):
401 UNAUTHENTICATED. {'error': {'code': 401, 'message': 'Request had invalid authentication
credentials. Expected OAuth 2 access token, login cookie or other valid authentication
credential.', 'status': 'UNAUTHENTICATED', 'details': [{'@type':
'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'ACCESS_TOKEN_TYPE_UNSUPPORTED',
'metadata': {'service': 'generativelanguage.googleapis.com'}}]}}
Environment: Python 3.12, google-genai SDK (latest as of July 2026), macOS.