Hello Google Gemini API team,
I’m encountering a reproducible authentication failure using a Google AI Studio Authorization Key with the official @google/genai SDK.
The issue reproduces with a minimal SDK-only script and persists independently of billing configuration.
Project Details
- Project Name: Default Gemini Project
- Project ID:
gen-lang-client-01412194..
- Project Number:
2540594963..
- Current Gemini API Tier: Free Tier
- Cloud Billing: Disabled
- Generative Language API: ENABLED
- Authorization Key Type: AUTH (Google AI Studio Authorization Key)
- Key Status: ACTIVE
- Project Binding: Confirmed
The API key value is intentionally not included.
Environment
- SDK:
@google/genai v2.19.0
- Node.js:
v24.14.0
- Model:
gemini-3.7-flash
- API Surface:
google.ai.generativelanguage.v1beta.GenerativeService.GenerateContent
Minimal Reproduction
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_DEV_API_KEY
});
const response = await ai.models.generateContent({
model: 'gemini-3.7-flash',
contents: 'Respond with OK',
config: {
thinkingConfig: {
thinkingLevel: 'low'
}
}
});
console.log(response.text);
Hello, this 401 ACCESS_TOKEN_TYPE_UNSUPPORTED error typically occurs when the client library, tool, or extension being used does not yet support the updated “AQ.” API key format, Please ensure your tools and SDK extensions are updated to the latest version supporting standard AQ API key header passing, or configure custom HTTP headers (x-goog-api-key). If you are still facing this issue after updating, please let us know.
Thanks for the suggestion.
I already tested both approaches:
- the official @google/genai SDK with the API key passed explicitly to GoogleGenAI
- a direct REST request using the x-goog-api-key header
Both return the same:
401 UNAUTHENTICATED
ACCESS_TOKEN_TYPE_UNSUPPORTED
The key is an active Google AI Studio AUTH/AQ key and the Generative Language API is enabled.
I’ll update the SDK to the latest available version and retest the minimal request. If the same error persists, is there a specific minimum SDK version or authentication configuration required for AQ-format keys?
I can provide project identifiers privately to Google staff if needed.
Hi @Daniela_Guerrero, Please update the gen ai SDK to the latest version here: google-genai · PyPI
Rotate your key, they changed their key format, again.