401 Error: ACCESS_TOKEN_TYPE_UNSUPPORTED with new "AQ." API Key

Hi Google AI Team,

I am experiencing a backend authentication issue with my newly generated API key from Google AI Studio. Instead of the traditional “AIza” prefix, my newly generated key starts with “AQ.”.

When I try to use this key with the latest google-genai Python SDK (specifically when calling client.files.upload or generating content), I immediately receive the following error:

google.genai.errors.ClientError: 401 UNAUTHENTICATED. {'error': {'code': 401, 'message': 'Request had invalid authentication credentials. Expected OAuth 2 access token... 'reason': 'ACCESS_TOKEN_TYPE_UNSUPPORTED'...}}

Here are my account details:

  • Project Number: 924733008…

  • API Key Prefix: AQ.Ab8RN6JywhTw4HqaKz…

It seems my project might be caught in the backend bug regarding the new key format permissions. Could you please help check my account and resolve this issue so I can continue my development?

Thank you!

Hello @linh_d_ng ,

We are moving away from Traffic keys (Alza) and towards a more secure Authentication Key (AQ). AI Studio will now only generate Authentication Key (AQ) keys. More information on key usage can be found in the Using Gemini API keys documentation.

Please submit any compatibility issues with services / SDKs etc. in this form for our engineering team to review. Thanks!