Skip to Content
IDEsOpenCodeReasoning effort

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 opencode

Upstream:

--variant, reasoningEffort, and thinking.budgetTokens are defined in OpenCode’s models documentation.

OpenCode: Models

Quick answer — change reasoning effort

  1. Open project or global config — opencode.json in the repo, or ~/.config/opencode/opencode.json.
  2. Set effort on the model under provider.<id>.models.<model-id>.options.
  3. Optionally override on a single agent under agent.<name>.options.
  4. Reload OpenCode (restart TUI or new session).
  5. 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 verifyStable (current docs)OpenCode v2
Config fileopencode.jsonopencode.json (same filename)
JSON schema URL"$schema": "https://opencode.ai/config.json"Check v2 config  if your install points at v2 docs
OpenAI reasoning effortprovider.<id>.models.<model>.options.reasoningEffortSame path — low / medium / high / xhigh
Anthropic thinking effortprovider.<id>.models.<model>.options.thinking.budgetTokensSame path — thinking.type + budgetTokens
Named variantsprovider.<id>.models.<model>.variants + --variantSame — cycle in TUI or opencode run --variant
Per-agent overrideagent.<name>.options (same keys as model options)Same — agent wins over global model options
Compaction (not reasoning)compaction.prune, compaction.reservedcompaction.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.

LayerConfig pathAffects
Global default model"model": "provider/model-id"All agents unless overridden
Provider modelprovider.*.models.*.optionsEvery agent using that model ID
Per agentagent.<name>.model + agent.<name>.optionsThat agent only
One-off CLIopencode 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?

SettingLocationExample key
OpenAI / OpenAI-compatible reasoning modelsprovider.<id>.models.<model>.optionsreasoningEffort
Anthropic extended thinkingsame paththinking.type, thinking.budgetTokens
Per-agent overrideagent.<name>.optionssame keys as above
Built-in effort presetsprovider.<id>.models.<model>.variantsnamed variants (see below)
TUI / sessionvariant_cycle keybindcycles 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):

ValueEffect
noneNo extended reasoning
minimalMinimal reasoning
lowLow reasoning effort
mediumMedium reasoning effort
highHigh reasoning effort (often provider default for thinking models)
xhighExtra 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:

VariantThinking budget
highHigh thinking budget (default for many Anthropic thinking models)
maxMaximum 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:

VariantEffect
lowLower effort / token budget
highHigher 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:

  1. Set explicit options or pick a low / none variant.
  2. Assign non-thinking models to Plan and @explore.
  3. Avoid thinking model IDs in the global "model" default.

How to disable or minimize reasoning

GoalAction
No thinking tokensUse a non-thinking model ID (no extended-reasoning variant)
Lowest effort on a reasoning modelreasoningEffort: "none" or "minimal" (OpenAI); smallest budgetTokens (Anthropic)
Cheap planningagent.plan.model → Haiku or mid-tier without thinking
One-off low effortopencode run --variant low "..."
Turn off auto compaction overheadSeparate 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 styleControl mechanismVerified in OpenCode docs
OpenAI (openai)reasoningEffort, variantsYes
Anthropic (anthropic)thinking.budgetTokens, variants high / maxYes
Googlevariants low / highYes
OpenRouter / customPassthrough options — depends on upstream modelPer gateway docs
Local OpenAI-compatibleOnly if server implements reasoning paramsTest 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)

MistakeWhy it fails
reasoningEffort at provider config on Anthropic thinking modelsProvider-level Anthropic expects thinking.budgetTokens (agent-level options may differ by OpenCode version)
Options on wrong model IDKeys apply per models.<id> entry — typo in ID = silent default
Global model only, no agent splitPlan and Build both inherit thinking defaults
budgetTokens on OpenAI GPT-5Wrong schema — use reasoningEffort
Custom provider options the server ignoresGateway drops unknown fields; effort unchanged
Expecting --variant without variant definitionsVariant must exist on that model/provider or CLI falls back
Editing config but not restarting long TUI sessionNew 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

TaskModel / effort
Grep-style questions, plan reviewHaiku / mid-tier, no thinking
Multi-file refactorCapable model, moderate effort
Novel architecture, deep debugThinking 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.

Last updated on