From d1d5b7e124a4a0042c97f677b06987b2254d1bd8 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 28 Mar 2026 13:52:11 +0100 Subject: [PATCH] fix: simplify gemini token endpoint to avoid SDK instantiation errors Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/gemini-live.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib/gemini-live.ts b/src/lib/gemini-live.ts index 2aadfd5..34df263 100644 --- a/src/lib/gemini-live.ts +++ b/src/lib/gemini-live.ts @@ -1,4 +1,4 @@ -import { GoogleGenAI, Type } from '@google/genai'; +import { Type } from '@google/genai'; // ─── Constants ──────────────────────────────────────────────────────────────── @@ -152,13 +152,7 @@ export function buildLiveConfig(locale: string) { // ─── Ephemeral Token ────────────────────────────────────────────────────────── -export async function generateEphemeralToken(locale: string) { - // GoogleGenAI is instantiated here to validate the API key at request time. - // The SDK does not yet expose an ephemeral token API; in production, replace - // this with ai.auth.tokens.create() or equivalent when available to avoid - // exposing the API key to the client. - new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! }); - +export function generateEphemeralToken(locale: string) { const config = buildLiveConfig(locale); return { config, model: GEMINI_LIVE_MODEL }; }