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
14 changes: 3 additions & 11 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,6 @@ export function variants(model: Provider.Model): Record<string, Record<string, a

const id = model.id.toLowerCase()
const adaptiveEfforts = anthropicAdaptiveEfforts(model.api.id)
if (
id.includes("deepseek") ||
id.includes("minimax") ||
id.includes("glm") ||
id.includes("mistral") ||
id.includes("kimi") ||
id.includes("k2p5") ||
id.includes("qwen") ||
id.includes("big-pickle")
)
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 Expand Up @@ -635,6 +624,9 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
reasoningConfig: {
type: "adaptive",
maxReasoningEffort: effort,
...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
? { display: "summarized" }
: {}),
},
},
]),
Expand Down
32 changes: 19 additions & 13 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 with reasoning enabled returns WIDELY_SUPPORTED_EFFORTS via openai-compatible", () => {
const model = createMockModel({
id: "deepseek/deepseek-chat",
providerID: "deepseek",
Expand All @@ -2082,35 +2082,39 @@ 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("deepseek without reasoning capability returns empty object", () => {
const model = createMockModel({
id: "minimax/minimax-model",
providerID: "minimax",
id: "deepseek/deepseek-chat",
providerID: "deepseek",
capabilities: { reasoning: false },
api: {
id: "minimax-model",
url: "https://api.minimax.com",
id: "deepseek-chat",
url: "https://api.deepseek.com",
npm: "@ai-sdk/openai-compatible",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
})

test("glm returns empty object", () => {
test("glm with reasoning enabled returns WIDELY_SUPPORTED_EFFORTS via openai-compatible", () => {
const model = createMockModel({
id: "glm/glm-4",
providerID: "glm",
id: "zai-coding/glm-5.1",
providerID: "zai-coding",
api: {
id: "glm-4",
url: "https://api.glm.com",
id: "glm-5.1",
url: "https://open.bigmodel.cn/api/paas/v4",
npm: "@ai-sdk/openai-compatible",
},
})
const result = ProviderTransform.variants(model)
expect(result).toEqual({})
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
expect(result.medium).toEqual({ reasoningEffort: "medium" })
})

test("mistral returns empty object", () => {
Expand Down Expand Up @@ -2804,12 +2808,14 @@ describe("ProviderTransform.variants", () => {
reasoningConfig: {
type: "adaptive",
maxReasoningEffort: "xhigh",
display: "summarized",
},
})
expect(result.max).toEqual({
reasoningConfig: {
type: "adaptive",
maxReasoningEffort: "max",
display: "summarized",
},
})
})
Expand Down
Loading