[FEATURE]: opencode could automatically use different models based on task type
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
What feature would you like to see?
Leading agentic coding tools enable configurable model selection for different task types executed by the agent; opencode would benefit from adopting a similar approach.
Enable configuration of defaults via environment variables:
- model_reasoning: the model for complex reasoning and architecture decisions (e.g. anthropic/claude-opus-4-20250514")
- model_execution: the model for code generation and implementation (e.g. anthropic/claude-sonnet-4-20250514)
- model_tool: the model for tool execution or background functionality (e.g. anthropic/claude-haiku-4-20250514)
By default, in plan mode, opencode would automatically use model_reasoning for complex reasoning and architecture decisions and use model_tool for efficient execution of tools (find, grep, etc.). By delegating tool execution to the more efficient model and reasoning to the stronger model, we get the best of all worlds for efficient, speed and cost.
Support hybrid settings (e.g., plan), which use a stronger model (model_reasoning) for planning (still using model_tool when appropriate), then switch to a more efficient model (model_execution) for execution (still using model_tool when appropriate).
So in ~/.config/opencode/config.json:
{
"model": "anthropic/claude-opus-4-20250514",
"model_reasoning": "anthropic/claude-opus-4-20250514",
"model_execution": "anthropic/claude-sonnet-4-20250514",
"model_tool": "anthropic/claude-haiku-4-20250514"
}
or for hybrid mode:
{
"model": "codeplan",
"model_reasoning": "anthropic/claude-opus-4-20250514",
"model_execution": "anthropic/claude-sonnet-4-20250514",
"model_tool": "anthropic/claude-haiku-4-20250514"
}
Similar issues:
- https://github.com/anomalyco/opencode/issues/6976
- https://github.com/anomalyco/opencode/issues/8278
Related issues:
- https://github.com/anomalyco/opencode/issues/6558
- https://github.com/anomalyco/opencode/issues/6645
- https://github.com/anomalyco/opencode/issues/6645
- https://github.com/anomalyco/opencode/issues/6651
- https://github.com/anomalyco/opencode/issues/7713