From 3cf379862bb4df33dbed7afb71b7b022ca763531 Mon Sep 17 00:00:00 2001 From: serhiizghama Date: Fri, 3 Apr 2026 04:25:26 +0700 Subject: [PATCH] fix(gemini): forward requestOptions.headers to GoogleGenAI httpOptions --- packages/openai-adapters/src/apis/Gemini.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/openai-adapters/src/apis/Gemini.ts b/packages/openai-adapters/src/apis/Gemini.ts index f7298267849..3126671bc9c 100644 --- a/packages/openai-adapters/src/apis/Gemini.ts +++ b/packages/openai-adapters/src/apis/Gemini.ts @@ -75,10 +75,16 @@ export class GeminiApi implements BaseLlmApi { this.apiBase = config.apiBase ?? this.apiBase; // Create GoogleGenAI with native fetch to avoid pollution // from Vercel AI SDK packages that can break stream handling + const customHeaders = this.config.requestOptions?.headers; this.genAI = withNativeFetch( () => new GoogleGenAI({ apiKey: this.config.apiKey, + ...(customHeaders && { + httpOptions: { + headers: customHeaders, + }, + }), }), ); }