fix(opencode): expose Grok reasoning variants (#36017)

This commit is contained in:
Aiden Cline 2026-07-09 00:13:10 -05:00 committed by GitHub
parent 0abbcddac2
commit 1db5c2402c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -734,7 +734,6 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
high: { reasoningEffort: "high" },
}
}
if (id.includes("grok")) return {}
switch (model.api.npm) {
case "@openrouter/ai-sdk-provider":

View file

@ -3339,7 +3339,7 @@ describe("ProviderTransform.variants", () => {
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
})
test("grok-4 returns empty object", () => {
test("grok-4 uses the provider's standard efforts", () => {
const model = createMockModel({
id: "openrouter/grok-4",
providerID: "openrouter",
@ -3350,7 +3350,8 @@ describe("ProviderTransform.variants", () => {
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.medium).toEqual({ reasoning: { effort: "medium" } })
})
test("grok-3-mini returns low and high with reasoning", () => {
@ -3766,18 +3767,19 @@ describe("ProviderTransform.variants", () => {
})
describe("@ai-sdk/xai", () => {
test("grok-3 returns empty object", () => {
test("grok-4.5 uses standard reasoning efforts", () => {
const model = createMockModel({
id: "xai/grok-3",
id: "xai/grok-4.5",
providerID: "xai",
api: {
id: "grok-3",
id: "grok-4.5",
url: "https://api.x.ai",
npm: "@ai-sdk/xai",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.medium).toEqual({ reasoningEffort: "medium" })
})
test("grok-3-mini returns low and high with reasoningEffort", () => {