Skip to content

Commit de12b61

Browse files
committed
feat(opencode): none variant disables thinking for deepseek-v4 models
Mirrors the minimax-m3 none shape ({ thinking: { type: "disabled" } }) and matches agent-frontmatter options.thinking passthrough byte-for-byte.
1 parent 896c19c commit de12b61

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

packages/opencode/src/provider/transform.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,18 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
863863
if (model.api.id.toLowerCase().includes("north-mini-code")) {
864864
return Object.fromEntries(["none", "high"].map((effort) => [effort, { reasoningEffort: effort }]))
865865
}
866+
const isDeepseekV4 = model.api.id.toLowerCase().includes("deepseek-v4")
866867
const efforts = [...WIDELY_SUPPORTED_EFFORTS]
867-
if (model.api.id.toLowerCase().includes("deepseek-v4")) {
868+
if (isDeepseekV4) {
868869
efforts.push("max")
869870
}
870-
return Object.fromEntries(efforts.map((effort) => [effort, { reasoningEffort: effort }]))
871+
const result: Record<string, Record<string, any>> = Object.fromEntries(
872+
efforts.map((effort) => [effort, { reasoningEffort: effort }]),
873+
)
874+
if (isDeepseekV4) {
875+
result.none = { thinking: { type: "disabled" } }
876+
}
877+
return result
871878

872879
case "@ai-sdk/azure":
873880
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/azure

packages/opencode/test/provider/transform.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4186,6 +4186,25 @@ describe("ProviderTransform.variants", () => {
41864186
high: { reasoningEffort: "high" },
41874187
})
41884188
})
4189+
4190+
test("deepseek-v4 includes none (thinking disabled) and low/medium/high/max with reasoningEffort", () => {
4191+
const model = createMockModel({
4192+
id: "openai-compatible/deepseek-v4-1",
4193+
providerID: "openai-compatible",
4194+
api: {
4195+
id: "deepseek-v4-1-latest",
4196+
url: "https://api.deepseek.com",
4197+
npm: "@ai-sdk/openai-compatible",
4198+
},
4199+
})
4200+
const result = ProviderTransform.variants(model)
4201+
expect(Object.keys(result).sort()).toEqual(["high", "low", "max", "medium", "none"].sort())
4202+
expect(result.none).toEqual({ thinking: { type: "disabled" } })
4203+
expect(result.low).toEqual({ reasoningEffort: "low" })
4204+
expect(result.medium).toEqual({ reasoningEffort: "medium" })
4205+
expect(result.high).toEqual({ reasoningEffort: "high" })
4206+
expect(result.max).toEqual({ reasoningEffort: "max" })
4207+
})
41894208
})
41904209

41914210
describe("@ai-sdk/azure", () => {

0 commit comments

Comments
 (0)