From 3edcb3ca2b76b8cc015d5a51000bf1012e5f7bb1 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Wed, 19 Aug 2026 08:59:11 -0500 Subject: [PATCH] fix(core): route Vertex Gemini through native provider (#43433) Signed-off-by: Major Hayden --- packages/core/src/aisdk-native.ts | 13 +++++++++++++ packages/core/test/aisdk-native.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/packages/core/src/aisdk-native.ts b/packages/core/src/aisdk-native.ts index 926c52c533..859b40661f 100644 --- a/packages/core/src/aisdk-native.ts +++ b/packages/core/src/aisdk-native.ts @@ -51,6 +51,19 @@ export function map(input: MapInput): Mapping | undefined { ...mapGoogleOptions(input.settings), }, } + case "@ai-sdk/google-vertex": + return { + package: "@opencode-ai/ai/providers/google-vertex", + settings: { + ...baseSettings, + ...(typeof input.settings.accessToken === "string" ? { accessToken: input.settings.accessToken } : {}), + ...mapAPIKey(input.settings), + ...(typeof input.settings.location === "string" ? { location: input.settings.location } : {}), + ...(typeof input.settings.project === "string" ? { project: input.settings.project } : {}), + ...mapGoogleOptions(input.settings), + }, + ...(isStringRecord(input.settings.headers) ? { headers: input.settings.headers } : {}), + } case "@ai-sdk/google-vertex/anthropic": return { package: "@opencode-ai/ai/providers/google-vertex/messages", diff --git a/packages/core/test/aisdk-native.test.ts b/packages/core/test/aisdk-native.test.ts index 7d28d19e35..0fd2ccf6cd 100644 --- a/packages/core/test/aisdk-native.test.ts +++ b/packages/core/test/aisdk-native.test.ts @@ -273,6 +273,29 @@ describe("AISDKNative", () => { }) }) + test("maps Vertex Gemini settings to the native Gemini route", () => { + expect( + map("@ai-sdk/google-vertex", { + accessToken: "vertex-token", + baseURL: "https://vertex.example/v1", + headers: { "x-test": "value" }, + location: "eu", + project: "vertex-project", + thinkingConfig: { thinkingLevel: "high" }, + }), + ).toEqual({ + package: "@opencode-ai/ai/providers/google-vertex", + settings: { + accessToken: "vertex-token", + baseURL: "https://vertex.example/v1", + location: "eu", + project: "vertex-project", + providerOptions: { gemini: { thinkingConfig: { thinkingLevel: "high" } } }, + }, + headers: { "x-test": "value" }, + }) + }) + test("maps Vertex Anthropic settings to native Messages", () => { expect( map("@ai-sdk/google-vertex/anthropic", {