anomalyco / anomalyco/opencode
Reasoning toggle (thinking.type=enabled) not emitted for OpenAI-compatible models with a models.dev reasoning toggle (DeepSeek V4 Flash)
@jlongster is already working on this.
Since Jul 31, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Bug: opencode doesn't enable reasoning for OpenAI-compatible models that declare a reasoning toggle in models.dev (e.g. DeepSeek V4 Flash via Zen).
Model: opencode/deepseek-v4-flash — its models.dev entry declares reasoning_options = [{ type = "toggle" }, { type = "effort", values = ["high","max"] }] with [interleaved] field = "reasoning_content".
Expected: reasoning engages (e.g. via --variant max or options.thinking), like the Anthropic thinking option does.
Actual: reasoning never engages. --variant max/high, --thinking, options.reasoningEffort, and options.thinking = {type:"enabled"} all yield zero reasoning_content and 0 reasoning tokens; per-request cost stays flat. providerOptions passthrough of thinking returns HTTP 400.
Repro: the gateway itself honours the toggle — same key/endpoint via curl returns full reasoning_content:
curl https://opencode.ai/zen/v1/chat/completions -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" -d '{"model":"deepseek-v4-flash","thinking":{"type":"enabled"},"reasoning_effort":"max","stream":true,"messages":[{"role":"user","content":"9.11 vs 9.8? reason step by step."}]}'
Through opencode run -m opencode/deepseek-v4-flash --thinking the stream has no reasoning parts.
For comparison, OpenAI-style models on the same gateway (e.g. opencode/gpt-5.6-luna --variant max) DO engage reasoning correctly via reasoning_effort, so the gap is specific to the toggle capability.
Likely cause: the OpenAI-compatible adapter forwards reasoning_effort but not the models.dev toggle field (thinking.type=enabled).
Env: opencode 1.18.5, Linux.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.