diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 56e1647135..6a187aa601 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -645,7 +645,7 @@ function effortVariant(model: Provider.Model, effort: ReasoningEffortValue) { } return { effort } } - if (idIncludes(model, "google")) return { includeThoughts: true, thinkingLevel: effort } + if (idIncludes(model, "google")) return { thinkingConfig: { includeThoughts: true, thinkingLevel: effort } } return { reasoningEffort: effort } case "@ai-sdk/anthropic": diff --git a/packages/opencode/test/provider/transform.test.ts b/packages/opencode/test/provider/transform.test.ts index 705aa72976..e19707c7d1 100644 --- a/packages/opencode/test/provider/transform.test.ts +++ b/packages/opencode/test/provider/transform.test.ts @@ -3188,6 +3188,24 @@ describe("ProviderTransform.variants", () => { expect(result.high).toEqual({ thinkingConfig: { includeThoughts: true, thinkingBudget: 16_000 } }) expect(result.max).toEqual({ thinkingConfig: { includeThoughts: true, thinkingBudget: 32_768 } }) }) + + test("uses reasoning_options effort for Google thinkingConfig variants", () => { + const result = ProviderTransform.variants( + createMockModel({ + id: "google/gemini-3.1-pro-preview", + providerID: "gateway", + api: { + id: "google/gemini-3.1-pro-preview", + url: "https://gateway.ai", + npm: "@ai-sdk/gateway", + }, + reasoning_options: [{ type: "effort", values: ["low", "high"] }], + }), + ) + expect(Object.keys(result)).toEqual(["low", "high"]) + expect(result.low).toEqual({ thinkingConfig: { includeThoughts: true, thinkingLevel: "low" } }) + expect(result.high).toEqual({ thinkingConfig: { includeThoughts: true, thinkingLevel: "high" } }) + }) }) describe("@ai-sdk/github-copilot", () => {