Drive Google Flow from Claude, Codex or a local control panel, on Mac or Windows — using your Google AI subscription credits instead of the pay-per-use video API. No browser extension.
Voice tab: accept Google AI Studio's new "AQ" keys
GTAI-1594a8b3fb9c6
diff --git a/CLAUDE.md b/CLAUDE.mdindex 010474f..7c768fc 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -300,6 +300,10 @@ The preview tool could not read the project while it lived in ~/Desktop; check tkey passes a format check AND Google accepts it (models list, key in a header, no TTS quota), so a bad paste cannever replace a working key. set_key is deliberately NOT an MCP tool - a key typed into the panel never reachesClaude. Tested only on the rejection path, so the user's real key was never overwritten.+- Key format (2026-10-13): new Google AI Studio keys start "AQ" instead of "AIza", and saveGeminiKey's prefix check+ (^AIza...) refused them in the panel. It now checks only the shape (20-512 key characters, no spaces, no template+ text) and leaves validity to Google's own models-list check. Both requests send the key in the x-goog-api-key header,+ which is format-agnostic. Privacy scans before a push must look for AQ-style keys as well as AIza ones.- CROSS-PLATFORM (2026-10-02): every OS difference lives in src/platform.ts - COMPUTER/BIN wording, moveToBin (Mac:rename into ~/.Trash; Windows: PowerShell Microsoft.VisualBasic ...SendToRecycleBin; Linux: `gio trash`, else~/.local/share/Trash/files), extractZip (`tar` is bsdtar on macOS and Windows 10+ and reads ZIPs; `unzip` fallback),diff --git a/src/gemini.ts b/src/gemini.tsindex 0a836ec..cd730e0 100644--- a/src/gemini.ts+++ b/src/gemini.ts@@ -28,7 +28,8 @@ export const GEMINI_VOICES = [{ name: "Sadaltager", description: "knowledgeable" }, { name: "Sulafat", description: "warm" },];-// Real keys look like "AIza..." and are ~39 chars; anything shorter or still holding template text is not a key.+// A key is one unbroken run of characters - older AI Studio keys start "AIza", newer ones "AQ" (2026-10). Anything+// shorter or still holding template text is not a key.export const geminiKey = (): string | undefined => {const key = (process.env.GEMINI_API_KEY ?? (existsSync(KEY_FILE) ? readFileSync(KEY_FILE, "utf8") : "")).trim();if (!key || key.length < 20 || /^(YOUR|PASTE|<|\$)/i.test(key) || /_KEY|KEY_HERE|EXAMPLE/i.test(key)) return undefined;@@ -41,8 +42,10 @@ export const geminiKey = (): string | undefined => {// and spends no text-to-speech quota.export async function saveGeminiKey(raw: string): Promise<{ saved: true; ending: string }> {const key = raw.trim();- if (!/^AIza[0-9A-Za-z_-]{30,}$/.test(key)) {- throw new Error("That doesn't look like a Google AI Studio key. Real keys start with AIza and are about 39 characters long.");+ // Only the shape is checked here (Google moved new keys from "AIza..." to "AQ..." in October 2026, and a prefix+ // check refused them); whether the key WORKS is decided by Google itself just below.+ if (!/^[A-Za-z0-9._~+/=-]{20,512}$/.test(key) || /^(YOUR|PASTE|<|\$)/i.test(key) || /_KEY|KEY_HERE|EXAMPLE/i.test(key)) {+ throw new Error("That doesn't look like a Google AI Studio key. Copy the whole key from aistudio.google.com/apikey, with no spaces.");}const res = await fetch("https://generativelanguage.googleapis.com/v1beta/models?pageSize=1", { headers: { "x-goog-api-key": key } }).catch(() => null);if (!res) throw new Error("Couldn't reach Google to check the key. Check your internet connection and try again.");@@ -67,7 +70,7 @@ export async function speakWithGemini(text: string, voice: string, target: strin? `The key file still holds placeholder text, not a key.\n\n`: `No Gemini key yet.\n\n`) +`1. Open aistudio.google.com/apikey and click "Create API key".\n` +- `2. Copy it — it starts with AIza and is about 39 characters.\n` ++ `2. Copy the whole key (older keys start with AIza, newer ones with AQ).\n` +`3. Paste it into Flow Studio: Voice tab -> Google AI Studio key -> Save key. It is checked with Google and saved\n` +` only on this computer - never paste it into a chat.`,);diff --git a/studio/index.html b/studio/index.htmlindex 2d38c06..34ec157 100644--- a/studio/index.html+++ b/studio/index.html@@ -267,7 +267,7 @@ audio{width:100%;margin-top:12px;filter:invert(1) hue-rotate(180deg)}<div class="phrase" id="n_engineNote"></div><div id="n_keyWrap"><label class="f" for="n_key">Google AI Studio key</label>- <div class="rowbtns" style="margin-top:0;flex-wrap:nowrap"><input type="password" id="n_key" autocomplete="off" spellcheck="false" placeholder="AIza…" style="flex:1;min-width:0"><button type="button" class="btn small" id="n_keysave">Save key</button></div>+ <div class="rowbtns" style="margin-top:0;flex-wrap:nowrap"><input type="password" id="n_key" autocomplete="off" spellcheck="false" placeholder="Paste your key" style="flex:1;min-width:0"><button type="button" class="btn small" id="n_keysave">Save key</button></div><p class="empty" id="n_keyStatus" style="margin-top:6px"></p></div><div class="grid2">