Skip to content
Closed
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
10 changes: 10 additions & 0 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,16 @@ export function reasoningVariants(model: ModelsDev.Model, target: Provider.Model
if (options === undefined) return
if (options.length === 0) return {}

// DeepSeek V4 exposes a thinking toggle; `reasoning_effort: "none"` turns it
// off. Add a `none` variant alongside its effort tiers so thinking can be
// disabled from the model variants menu.
if (target.api.id.toLowerCase().includes("deepseek-v4")) {
return nonEmptyVariants({
none: { reasoningEffort: "none" },
...effortVariants(target, options.find((option) => option.type === "effort")?.values ?? []),
})
}

const effort = options.find((option) => option.type === "effort")
if (effort) return effortVariants(target, effort.values)

Expand Down
14 changes: 14 additions & 0 deletions packages/opencode/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,20 @@ describe("ProviderTransform.reasoningVariants", () => {
)
})

test("adds a none variant to disable thinking for DeepSeek V4", () => {
expect(
ProviderTransform.reasoningVariants(
model([{ type: "toggle" }, { type: "effort", values: ["low", "high", "max"] }]),
target("@ai-sdk/openai-compatible", "deepseek-v4-flash"),
),
).toEqual({
none: { reasoningEffort: "none" },
low: { reasoningEffort: "low" },
high: { reasoningEffort: "high" },
max: { reasoningEffort: "max" },
})
})

test("combines effort with extended thinking for Claude Opus 4.5", () => {
expect(
ProviderTransform.reasoningVariants(
Expand Down
Loading