From efa43182a5529648fa41664e85327189e97b1929 Mon Sep 17 00:00:00 2001 From: Jordan Ritter Date: Sat, 14 Mar 2026 22:50:51 -0700 Subject: [PATCH] docs: add Gemini base URL setup instructions to README The Gemini section was a comment with no actionable env var. Added concrete code examples for both @google/genai (v1.x) and @google/generative-ai (v0.x) showing how to set the base URL. Also added missing ANTHROPIC_API_KEY=mock-key to the env block. --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c45ecd8a..2ad12313 100644 --- a/README.md +++ b/README.md @@ -117,9 +117,29 @@ OPENAI_API_KEY=mock-key # Or for Anthropic Claude: ANTHROPIC_BASE_URL=http://localhost:5555/v1 +ANTHROPIC_API_KEY=mock-key -# Or for Google Gemini — point at the base URL: -# http://localhost:5555/v1beta +# Or for Google Gemini (set baseUrl in code — see below): +GOOGLE_API_KEY=mock-key +``` + +For Google Gemini, the SDK doesn't support a base URL env var — pass it in code: + +```typescript +// @google/genai (v1.x) +import { GoogleGenAI } from "@google/genai"; +const ai = new GoogleGenAI({ + apiKey: process.env.GOOGLE_API_KEY, + httpOptions: { baseUrl: "http://localhost:5555" }, +}); + +// @google/generative-ai (v0.x) +import { GoogleGenerativeAI } from "@google/generative-ai"; +const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY!); +const model = genAI.getGenerativeModel( + { model: "gemini-2.0-flash" }, + { baseUrl: "http://localhost:5555" }, +); ``` ### JSON Fixture Files