Subagents handle scoped tasks like file searches, research, and code analysis. They don’t need the full power of Opus, so route them to Sonnet for significant savings.
Setup
# In your shell profile (.zshrc, .bashrc)
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-6"
Now your main session uses Opus for complex reasoning while subagents use Sonnet for research, exploration, and validation tasks.
Other Cost Environment Variables
# Suppress background token usage (suggestions, tips)
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
# Control reasoning effort (low/medium/high/max/auto)
export CLAUDE_CODE_EFFORT_LEVEL=medium
When to Use
- Long sessions with many subagent calls, where the savings compound
- Research-heavy tasks where subagents do file exploration
- CI/CD pipelines where you’re paying per token
When NOT to Use
- When subagent tasks require complex multi-step reasoning
- When subagents need to make nuanced architectural decisions
- If you notice subagent quality dropping, upgrade back to Opus