Account restricted to AQ keys — returning 401 ACCESS_TOKEN_TYPE_UNSUPPORTED in Python SDK

Hello,

I am trying to build a project using the new google-genai Python SDK, but my newly generated API key from Google AI Studio starts with AQ. instead of AIza.

When I try to run a simple client.models.generate_content() request, I receive the following backend error:

401 UNAUTHENTICATED. {'error': {'code': 401, 'message': 'Request had invalid authentication credentials... 'reason': 'ACCESS_TOKEN_TYPE_UNSUPPORTED'}

My Python code is correct and I am using the latest SDK, but the server seems to be misidentifying the AQ. key as an OAuth token and rejecting it.

Could someone please review my project and resolve this authentication glitch or allow my account to generate standard AIza keys so I can continue development?

Thank you!

Hello @Muhammad_Ahsan2 ,

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!