Environment:
- @google/genai SDK v1.50.1 (TypeScript/Node.js)
- Endpoint: POST /v1alpha/auth_tokens
- Model: gemini-3.1-flash-live-preview
Issue:
Ephemeral token creation for the Live API fails with INVALID_ARGUMENT (400) when using new-format API keys that start with AQ. (53 chars).
The same call succeeds with legacy-format keys starting with AIzaSy (39 chars).
Both keys are from the same Google Cloud project, same billing account, generated in Google AI Studio. Regular generateContent calls work
fine with both key formats — only authTokens.create is affected.
Reproduction:
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: "AQ.xxx..." }); // new format key
const token = await ai.authTokens.create({
config: {
httpOptions: { apiVersion: "v1alpha" },
},
});
// → 400 INVALID_ARGUMENT
Replacing the key with a legacy AIzaSy… key → works immediately.
What I verified:
- Even the most minimal config (empty, just httpOptions) fails with AQ. keys
- Intercepted outgoing requests: the SDK sends identical POST /v1alpha/auth_tokens requests for both key types — same URL, method, body.
Only the key differs. - Tested with v1alpha, v1beta, v1 — only v1alpha reaches the endpoint (others return 404), confirming the version is correct
- Updated SDK to latest (1.50.1) — no change
Expected behavior: authTokens.create should work with both API key formats, or at least return a meaningful error (e.g.
UNSUPPORTED_KEY_TYPE) instead of generic INVALID_ARGUMENT.