Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,13 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
id.includes("k2p5") ||
id.includes("qwen") ||
id.includes("big-pickle")
)
return {}
) {
if (
model.api.npm !== "@ai-sdk/openai-compatible" ||
(!id.includes("deepseek") && !id.includes("minimax") && !id.includes("glm"))
)
return {}
}

// see: https://docs.x.ai/docs/guides/reasoning#control-how-hard-the-model-thinks
if (id.includes("grok") && id.includes("grok-3-mini")) {
Expand Down
30 changes: 25 additions & 5 deletions packages/opencode/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ describe("ProviderTransform.variants", () => {
expect(result).toEqual({})
})

test("deepseek returns empty object", () => {
test("deepseek openai-compatible models return reasoning variants", () => {
const model = createMockModel({
id: "deepseek/deepseek-chat",
providerID: "deepseek",
Expand All @@ -2082,10 +2082,12 @@ describe("ProviderTransform.variants", () => {
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})

test("minimax returns empty object", () => {
test("minimax openai-compatible models return reasoning variants", () => {
const model = createMockModel({
id: "minimax/minimax-model",
providerID: "minimax",
Expand All @@ -2096,10 +2098,12 @@ describe("ProviderTransform.variants", () => {
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})

test("glm returns empty object", () => {
test("glm openai-compatible models return reasoning variants", () => {
const model = createMockModel({
id: "glm/glm-4",
providerID: "glm",
Expand All @@ -2110,6 +2114,22 @@ describe("ProviderTransform.variants", () => {
},
})
const result = ProviderTransform.variants(model)
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.low).toEqual({ reasoningEffort: "low" })
expect(result.high).toEqual({ reasoningEffort: "high" })
})

test("deepseek models still return empty object for non-compatible SDKs", () => {
const model = createMockModel({
id: "deepseek/deepseek-chat",
providerID: "deepseek",
api: {
id: "deepseek-chat",
url: "https://api.deepinfra.com",
npm: "@ai-sdk/deepinfra",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
})

Expand Down
Loading