How to change reasoning effort in OpenCode
For one invocation, use --variant low:
opencode run --variant low "your prompt"To skip the flag entirely, install tokenmin and launch OpenCode through it:
curl -fsSL https://tokenminning.ai/install.sh | sh
tokenmin opencodeUpstream:
--variant, reasoningEffort, and thinking.budgetTokens are defined in OpenCode’s models
documentation.
Quick answer — change reasoning effort
- Open project or global config —
opencode.jsonin the repo, or~/.config/opencode/opencode.json. - Set effort on the model under
provider.<id>.models.<model-id>.options. - Optionally override on a single agent under
agent.<name>.options. - Reload OpenCode (restart TUI or new session).
- Confirm with
opencode models <provider>and a test prompt.
File: opencode.json at project root (or global path above).
Scopes: global model default → provider model options → per-agent model + options (agent wins).
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-5",
"provider": {
"openai": {
"models": {
"gpt-5": {
"options": {
"reasoningEffort": "low"
}
}
}
},
"anthropic": {
"models": {
"claude-sonnet-4-5-20250929": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
}
}
}
}
}
},
"agent": {
"plan": {
"model": "anthropic/claude-haiku-4-5"
},
"build": {
"model": "anthropic/claude-sonnet-4-5",
"options": {
"reasoningEffort": "medium"
}
}
}
}One-off without editing config:
opencode run --variant low "Summarize this diff"
opencode run -m openai/gpt-5 --variant high "Design the migration plan"Verified against OpenCode Models and CLI (August 2026).
Check your OpenCode version and schema
Before you change reasoning effort, confirm which OpenCode release and config schema you run. Reasoning keys live in opencode.json (project root or ~/.config/opencode/opencode.json), but v2 compaction and some agent fields differ from stable docs at opencode.ai/docs.
| What to verify | Stable (current docs) | OpenCode v2 |
|---|---|---|
| Config file | opencode.json | opencode.json (same filename) |
| JSON schema URL | "$schema": "https://opencode.ai/config.json" | Check v2 config if your install points at v2 docs |
| OpenAI reasoning effort | provider.<id>.models.<model>.options.reasoningEffort | Same path — low / medium / high / xhigh |
| Anthropic thinking effort | provider.<id>.models.<model>.options.thinking.budgetTokens | Same path — thinking.type + budgetTokens |
| Named variants | provider.<id>.models.<model>.variants + --variant | Same — cycle in TUI or opencode run --variant |
| Per-agent override | agent.<name>.options (same keys as model options) | Same — agent wins over global model options |
| Compaction (not reasoning) | compaction.prune, compaction.reserved | compaction.keep.tokens, compaction.buffer — see Context |
Run opencode --version. If your team tracks v2 docs, validate keys against v2 models before copying examples from stable guides. Wrong schema version usually means silent defaults — effort looks unchanged even after you edit opencode.json.
How do I change reasoning effort in OpenCode?
Edit opencode.json and set provider model options, or per-agent options. The agent block overrides global model options for that agent only — so you can run low effort on Plan and higher effort on Build without touching other agents.
| Layer | Config path | Affects |
|---|---|---|
| Global default model | "model": "provider/model-id" | All agents unless overridden |
| Provider model | provider.*.models.*.options | Every agent using that model ID |
| Per agent | agent.<name>.model + agent.<name>.options | That agent only |
| One-off CLI | opencode run --variant <name> | Single invocation |
Use opencode models or opencode models <provider> to list exact provider/model strings for your install.
Where does the reasoning effort setting go?
| Setting | Location | Example key |
|---|---|---|
| OpenAI / OpenAI-compatible reasoning models | provider.<id>.models.<model>.options | reasoningEffort |
| Anthropic extended thinking | same path | thinking.type, thinking.budgetTokens |
| Per-agent override | agent.<name>.options | same keys as above |
| Built-in effort presets | provider.<id>.models.<model>.variants | named variants (see below) |
| TUI / session | variant_cycle keybind | cycles active variant (Models: variants ) |
Project opencode.json overrides global config for team standards. See Config precedence .
OpenAI and OpenAI-compatible providers
For GPT-5 family and other reasoning models on the openai provider (or OpenAI-compatible custom providers), use reasoningEffort:
{
"provider": {
"openai": {
"models": {
"gpt-5": {
"options": {
"reasoningEffort": "high",
"textVerbosity": "low",
"reasoningSummary": "auto"
}
}
}
}
}
}Typical reasoningEffort values (OpenAI models in OpenCode — verify on your model):
| Value | Effect |
|---|---|
none | No extended reasoning |
minimal | Minimal reasoning |
low | Low reasoning effort |
medium | Medium reasoning effort |
high | High reasoning effort (often provider default for thinking models) |
xhigh | Extra high reasoning effort |
OpenCode also ships built-in variants per provider. For OpenAI, variant names map to effort levels (none, minimal, low, medium, high, xhigh). Cycle variants in the TUI with the variant_cycle keybind, or pass --variant to opencode run.
Custom OpenAI-compatible endpoints (local vLLM, corporate gateway) only honor keys the upstream server implements — unsupported options are ignored or error at request time.
Anthropic thinking budgets
Anthropic extended thinking uses a thinking object, not reasoningEffort:
{
"provider": {
"anthropic": {
"models": {
"claude-sonnet-4-5-20250929": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 16000
}
}
}
}
}
}
}OpenCode built-in Anthropic variants:
| Variant | Thinking budget |
|---|---|
high | High thinking budget (default for many Anthropic thinking models) |
max | Maximum thinking budget |
Lower budgetTokens to cap thinking output tokens. Disable thinking by choosing a non-thinking model ID or the lowest variant your workflow allows.
Google and other built-in providers
Google models in OpenCode expose variant-style effort:
| Variant | Effect |
|---|---|
low | Lower effort / token budget |
high | Higher effort / token budget |
Define custom variants under provider.<id>.models.<model>.variants to bundle options without duplicating model entries (Models: custom variants ).
OpenRouter and custom providers
When OpenCode routes through OpenRouter or a custom provider block, reasoning keys pass through in options if the upstream model supports them:
{
"provider": {
"openrouter": {
"models": {
"anthropic/claude-sonnet-4": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8000
}
}
}
}
}
}
}For Anthropic models via OpenRouter, prefer the thinking object when the model expects extended thinking — match the provider’s API shape. Wrong keys do not change effort; OpenCode sends them, but the gateway may strip or ignore unknown fields.
Custom provider template — see Providers:
{
"provider": {
"local": {
"npm": "@ai-sdk/openai-compatible",
"name": "Local gateway",
"options": {
"baseURL": "http://localhost:8000/v1",
"apiKey": "local"
},
"models": {
"my-reasoning-model": {
"options": {
"reasoningEffort": "low"
}
}
}
}
}
}Change effort for one model without affecting others
Use per-model options under provider.*.models, not the top-level model key alone:
{
"model": "anthropic/claude-sonnet-4-5",
"provider": {
"anthropic": {
"models": {
"claude-sonnet-4-5-20250929": {
"options": { "thinking": { "type": "enabled", "budgetTokens": 16000 } }
},
"claude-haiku-4-5": {}
}
}
},
"agent": {
"plan": { "model": "anthropic/claude-haiku-4-5" },
"build": { "model": "anthropic/claude-sonnet-4-5-20250929" }
}
}Only agents (or CLI invocations) that reference the thinking model pay thinking overhead. Plan on Haiku stays cheap; Build keeps higher effort.
What is the default reasoning effort in OpenCode?
When you do not set options or variants, OpenCode uses the provider’s default for that model — often the high thinking variant on Anthropic thinking models and medium–high effort on OpenAI reasoning models. There is no separate global “reasoning effort” knob outside provider/model config.
To minimize defaults:
- Set explicit
optionsor pick alow/nonevariant. - Assign non-thinking models to Plan and
@explore. - Avoid thinking model IDs in the global
"model"default.
How to disable or minimize reasoning
| Goal | Action |
|---|---|
| No thinking tokens | Use a non-thinking model ID (no extended-reasoning variant) |
| Lowest effort on a reasoning model | reasoningEffort: "none" or "minimal" (OpenAI); smallest budgetTokens (Anthropic) |
| Cheap planning | agent.plan.model → Haiku or mid-tier without thinking |
| One-off low effort | opencode run --variant low "..." |
| Turn off auto compaction overhead | Separate concern — see Context; compaction uses hidden agents |
Picking claude-haiku for Plan is usually more reliable than forcing low thinking on a Sonnet thinking variant.
Which providers and models expose reasoning controls?
| Provider style | Control mechanism | Verified in OpenCode docs |
|---|---|---|
OpenAI (openai) | reasoningEffort, variants | Yes |
Anthropic (anthropic) | thinking.budgetTokens, variants high / max | Yes |
variants low / high | Yes | |
| OpenRouter / custom | Passthrough options — depends on upstream model | Per gateway docs |
| Local OpenAI-compatible | Only if server implements reasoning params | Test with one prompt |
Run opencode models --verbose after opencode models --refresh to see which models your providers expose.
Configurations that do NOT work (and why)
| Mistake | Why it fails |
|---|---|
reasoningEffort at provider config on Anthropic thinking models | Provider-level Anthropic expects thinking.budgetTokens (agent-level options may differ by OpenCode version) |
| Options on wrong model ID | Keys apply per models.<id> entry — typo in ID = silent default |
Global model only, no agent split | Plan and Build both inherit thinking defaults |
budgetTokens on OpenAI GPT-5 | Wrong schema — use reasoningEffort |
| Custom provider options the server ignores | Gateway drops unknown fields; effort unchanged |
Expecting --variant without variant definitions | Variant must exist on that model/provider or CLI falls back |
| Editing config but not restarting long TUI session | New sessions pick up config; verify with fresh opencode run |
If effort changes seem ignored, confirm the exact model string in opencode models matches your config key, then check provider billing for thinking/output token spikes.
When reasoning is worth it
| Task | Model / effort |
|---|---|
| Grep-style questions, plan review | Haiku / mid-tier, no thinking |
| Multi-file refactor | Capable model, moderate effort |
| Novel architecture, deep debug | Thinking variant, scoped prompt |
Use Plan with cheap models; raise effort only on Build after you approve the approach. See Agents.
Subagents and parallel thinking
@general, @scout, and Task-delegated subagents spawn sessions with their own model choices. Restrict with permission.task; prefer read-only @explore for search. Each parallel subagent can run thinking models independently — multiply overhead fast. Details: Agents.
Troubleshooting
High output on simple tasks — Thinking default on Plan. Switch Plan to Haiku; lower reasoningEffort or budgetTokens.
Effort change ignored — Options must match provider + model ID. Check Providers merge order and run opencode models <provider>.
Stats spike after model change — New conversation when switching models; cache behavior resets. See Token usage.
Related
- OpenCode hub
- Providers — custom providers and
optionspassthrough - Context — context fill vs thinking tokens
- Token usage
- Model routing
- OpenCode: Models