Gemini API 401 ACCESS_TOKEN_TYPE_UNSUPPORTED with AI Studio AQ authorization key

Hello Google Gemini API Support,

I am experiencing an authentication problem with my Google AI Studio Paid Tier 1 project.

My AI Studio project has:

  • An active GEMINI_API_KEY secret.
  • An enabled Generative Language API.
  • Paid Tier 1 billing.
  • An automatically provisioned AQ-format authorization key.

When calling the Gemini Developer API using the official @google/genai SDK, version 2.32.0, the request fails.

Endpoint: generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent

HTTP response: 401 UNAUTHENTICATED

Error: ACCESS_TOKEN_TYPE_UNSUPPORTED

Message: API key not valid. Please pass a valid API key.

I reproduced the same error with an isolated direct API request, outside my application, confirming that this is not caused by my application’s PDF upload code.

The Generative Language API is already enabled, and the key is supplied through the documented GEMINI_API_KEY environment variable.

Could you investigate whether my authorization key or its associated service account/project has an authentication or provisioning problem?

I can provide my Google Cloud project ID and sanitized request details privately if required.

Thank you.

Hello @Hasan_Shurrab ,

AQ.-prefix API keys created in Google AI Studio work directly with the Gemini Developer API via the x-goog-api-key header and official SDKs with no additional setup required.

Please test a single request with a newly copied key pasted inline (rather than read from an environment variable) against gemini-3.8-flash:

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" -H "Content-Type: application/json" -H "x-goog-api-key: YOUR_API_KEY" -d '{"contents":[{"parts":[{"text":"Hello"}]}]}'

I will try that see if it works