401 ACCESS_TOKEN_TYPE_UNSUPPORTED for all new AQ. auth keys (fresh project, all endpoints, latest SDK)

Hello Google AI team,

I’m reporting a repeatable authentication failure with newly issued AI Studio authorization (AQ.) keys. Every request, across all endpoints and the official SDK, returns 401 ACCESS_TOKEN_TYPE_UNSUPPORTED.

**Environment**

- Account: free tier, personal Gmail, Google AI Studio

- Region: US (unsupported-region check passed; onboarding completed)

- Project: gemini-myproject (project number 4788606676..), created fresh in AI Studio UI on 2026-11-04

- Key: created in AI Studio UI, AQ. format (`AQ.Ab8RN6…`), restricted to Gemini API by default

- Key length verified: 53 chars, no whitespace, copied via the dashboard copy button

**Exact error (verbatim)**

```json

{

“error”: {

"code": 401,

"message": "API key not valid. Please pass a valid API key.",

"status": "UNAUTHENTICATED",

"details": \[{

  "@type": "type.googleapis.com/google.rpc.ErrorInfo",

  "reason": "ACCESS_TOKEN_TYPE_UNSUPPORTED",

  "metadata": {

    "method": "google.ai.generativelanguage.v1beta.GenerativeService.GenerateContent",

    "service": "generativelanguage.googleapis.com"

  }

}\]

}

}

```

**Repro (key redacted)**

```bash

curl -s -X POST “https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent” \

-H “x-goog-api-key: AQ.A…” \

-H “Content-Type: application/json” \

-d ‘{“contents”:[{“parts”:[{“text”:“Reply only: OK”}]}]}’

```

**Everything tried — identical 401 every time**

1. `x-goog-api-key` header (v1beta)

2. `?key=` query parameter

3. `Authorization: Bearer` header

4. `v1` and `v1alpha` endpoints

5. OpenAI-compatible endpoint `/v1beta/openai/chat/completions` → 400 “Invalid Auth key.”

6. Official Python SDK `google-genai==2.34.0` (`client.models.generate_content`)

7. Deleted the auto-created key and created a new key in a **new** project via the AI Studio UI — same result

8. Models tried: gemini-2.5-flash (model listing also 401)

**Notes**

- Network path is fine: the requests reach Google and return well-formed Google error payloads.

- The same key is rejected on other Google APIs, which is expected for keys restricted to the Generative Language API.

- This looks like the AQ. key rollout issue reported by several users since late September 2026.

**Ask**: could you check whether project 478860667686 is flagged, or confirm the correct authentication flow for AQ. auth keys? I can provide any additional diagnostics.

Hello @siyi_you ,

Project 478860... is active on the Free tier and is not flagged or blocked. AQ. authorization keys created in Google AI Studio work directly with the Gemini API with no extra IAM or service account setup.

To isolate why your requests are returning 401:

  • Make sure no existing GOOGLE_API_KEY or GEMINI_API_KEY environment variable is overriding your key (GOOGLE_API_KEY takes precedence in the SDK) and that no quotes, spaces, or characters were altered when copying, per Using Gemini API keys.
  • Pass your key via x-goog-api-key or ?key= on native /v1beta/models/... endpoints (Authorization: Bearer is only supported on the OpenAI-compatible endpoints).
  • Because gemini-2.5-flash is no longer available to newly created projects (see Gemini models), test in a clean shell against gemini-2.5-flash-lite with the newly copied key pasted directly inline:
env -u GOOGLE_API_KEY -u GEMINI_API_KEY curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -d '{"contents":[{"parts":[{"text":"Hello"}]}]}'

If that command still returns 401, let us know and confirm whether the key still appears active on your API Keys page and whether it was created in AI Studio or the Google Cloud console.

Hello Google AI Support,

I’m experiencing the same authentication issue with a newly generated Google AI Studio AQ authorization key.

Environment:

  • Windows 11

  • Python 3.15.2

  • google-genai 3.2.0

  • Google AI Studio Free tier

  • Project: JobSearch Automation

Tests performed:

  1. Official Python SDK – HTTP 401.

  2. Direct REST request using x-goog-api-key – HTTP 401.

  3. Confirmed GEMINI_API_KEY loads correctly from .env.

  4. Confirmed no conflicting GOOGLE_API_KEY environment variable.

  5. Created a replacement key and revoked the previously exposed key.

Exact error:
401 UNAUTHENTICATED
ACCESS_TOKEN_TYPE_UNSUPPORTED
API key not valid. Please pass a valid API key.

Could you please investigate whether this is an AQ authorization-key provisioning or compatibility issue and advise how to resolve it?

Thank you.