Skip to content

Commit bbcbd7b

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 c3fa235 commit bbcbd7b

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
@@ -864,11 +864,18 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
864864
if (model.api.id.toLowerCase().includes("north-mini-code")) {
865865
return Object.fromEntries(["none", "high"].map((effort) => [effort, { reasoningEffort: effort }]))
866866
}
867+
const isDeepseekV4 = model.api.id.toLowerCase().includes("deepseek-v4")
867868
const efforts = [...WIDELY_SUPPORTED_EFFORTS]
868-
if (model.api.id.toLowerCase().includes("deepseek-v4")) {
869+
if (isDeepseekV4) {
869870
efforts.push("max")
870871
}
871-
return Object.fromEntries(efforts.map((effort) => [effort, { reasoningEffort: effort }]))
872+
const result: Record<string, Record<string, any>> = Object.fromEntries(
873+
efforts.map((effort) => [effort, { reasoningEffort: effort }]),
874+
)
875+
if (isDeepseekV4) {
876+
result.none = { thinking: { type: "disabled" } }
877+
}
878+
return result
872879

873880
case "@ai-sdk/azure":
874881
// 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
@@ -3798,6 +3798,25 @@ describe("ProviderTransform.variants", () => {
37983798
high: { reasoningEffort: "high" },
37993799
})
38003800
})
3801+
3802+
test("deepseek-v4 includes none (thinking disabled) and low/medium/high/max with reasoningEffort", () => {
3803+
const model = createMockModel({
3804+
id: "openai-compatible/deepseek-v4-1",
3805+
providerID: "openai-compatible",
3806+
api: {
3807+
id: "deepseek-v4-1-latest",
3808+
url: "https://api.deepseek.com",
3809+
npm: "@ai-sdk/openai-compatible",
3810+
},
3811+
})
3812+
const result = ProviderTransform.variants(model)
3813+
expect(Object.keys(result).sort()).toEqual(["high", "low", "max", "medium", "none"].sort())
3814+
expect(result.none).toEqual({ thinking: { type: "disabled" } })
3815+
expect(result.low).toEqual({ reasoningEffort: "low" })
3816+
expect(result.medium).toEqual({ reasoningEffort: "medium" })
3817+
expect(result.high).toEqual({ reasoningEffort: "high" })
3818+
expect(result.max).toEqual({ reasoningEffort: "max" })
3819+
})
38013820
})
38023821

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

0 commit comments

Comments
 (0)