Black Friday sale: 85 Claude Code agents for $29 one-time · lifetime updatesGet access →
Coding·Updated ·7 min read

Claude Code Subagent Model: How to Choose and Set It

By Shubhranshu, creator of claudeagents · Last reviewed

To set the model for a Claude Code subagent, add a `model:` line to its frontmatter, for example `model: haiku`, `model: sonnet`, `model: opus` or `model: inherit`. You can also set a default for all subagents with the `CLAUDE_CODE_SUBAGENT_MODEL` environment variable. If you set nothing, a subagent runs on the same model as the conversation that starts it.

Choosing well matters. A read-only SEO check doesn't need your most powerful model, and a tricky race condition shouldn't run on your fastest one. Picking a model per subagent makes Claude Code faster and stretches your plan's limits.

This guide covers every way to set a subagent's model, which setting wins when they conflict, and a simple way to choose. Checked against Anthropic's subagent docs on 26 November 2026.

How to set a subagent's model (the model field)

Every subagent is a Markdown file in .claude/agents/ (this project) or ~/.claude/agents/ (all your projects). The model field goes in the frontmatter at the top. New to subagents? Start with how to create Claude Code subagents.

.claude/agents/on-page-auditor.md
---
name: on-page-auditor
description: Use after editing any page to check title, meta description, H1 and alt text. Read-only.
tools: Read, Grep, Glob
model: haiku
---

Check each page you are given. Never edit files.
Reply as: PASS / FIX — what's wrong — the exact fix.

That's all. The next time Claude uses on-page-auditor, it runs on Haiku, while your main chat stays on whatever model you picked. You can check which model a running subagent is on with /tasks.

Which values does the model field accept?

Values for the subagent model field (Anthropic API, 26 Nov 2026)
ValueRuns onUse it for
haikuHaiku 5.5Fast, simple, high-volume checks
sonnetSonnet 5.5Most everyday coding and writing
opusOpus 5.5Hard bugs, planning, architecture
fableFable 5.2Your hardest and longest-running tasks
inheritThe main conversation's modelAgents that should follow your /model choice
Full ID, e.g. claude-sonnet-5-5Exactly that versionPinning a version so it never changes

Aliases move to newer versions over time, and other providers (Bedrock, Vertex, Foundry) may map them to older models. See the model config docs.

Pinning a version
---
name: release-notes-writer
description: Use to turn merged changes into release notes.
tools: Read, Grep, Bash
model: claude-sonnet-5-5
---

Use a full model ID when you need repeatable results, for example in CI or for an agent whose output you've tuned carefully:

What happens if you don't set a model?

By default, a subagent you define runs on the same model as the conversation that starts it. If a subagent starts another subagent, the nested one follows its parent's model.

That means if you switch your main chat to Opus with /model, every subagent without a model line also runs on Opus. That's convenient but can burn through limits fast. Give cheap jobs an explicit model: haiku so they stay cheap.

CLAUDE_CODE_SUBAGENT_MODEL: one default for all subagents

If you want every subagent that doesn't choose a model to use the same one, set CLAUDE_CODE_SUBAGENT_MODEL. It accepts an alias like haiku or a full model name. Put it in .claude/settings.json (shared with your team) or ~/.claude/settings.json (just you):

.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_SUBAGENT_MODEL": "haiku"
  }
}

You can also export it in your shell: export CLAUDE_CODE_SUBAGENT_MODEL=haiku. It also applies to agent team teammates that aren't given a model. One catch from the docs: setting it alone doesn't change the model of the built-in Explore and Plan subagents.

Which setting wins? The resolution order

When more than one thing sets a model, Claude Code uses the first one in this list:

  1. The model Claude passes when it starts the subagent (an alias such as haiku). This happens when you ask for it, for example "run it with haiku".
  2. The `model` field in the subagent's file, including inherit.
  3. `CLAUDE_CODE_SUBAGENT_MODEL`.
  4. The main conversation's model (or the parent subagent's model, for nested subagents).
Choosing the model for one run
Use the on-page-auditor subagent on every page in src/app/blog.
Run it with haiku.

So the env variable is only a fallback. If your agent file says model: opus, setting CLAUDE_CODE_SUBAGENT_MODEL=haiku won't change it. To pick the model for one run only, just ask:

CLAUDE_CODE_SUBAGENT_MODEL_FORCE: make every subagent use one model

Sometimes you want one model for everything, for example to control costs for a team or to test agents on a cheaper model. Set CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 together with CLAUDE_CODE_SUBAGENT_MODEL (Claude Code v2.1.257 or later):

.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_SUBAGENT_MODEL": "sonnet",
    "CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1"
  }
}

With FORCE on, Claude Code ignores the model field in agent files, and Claude can't pass a model when it starts a subagent. Subagents set to model: inherit still use the parent's model.

Admins can go further with availableModels in managed settings, which blocks models for subagents too. A blocked model falls back to an allowed one.

Which model should each subagent use?

A simple rule: use the smallest model that does the job well. Test on Haiku first, and move up only if the results aren't good enough.

Model by job, as a starting point
JobModelExample agents
Read-only checks with a clear checklisthaikuon-page-auditor, secrets-checker, link checker
Searching and summarising codehaiku or sonnetcodebase explorer, stack-trace-explainer
Writing code, tests and copysonnetfrontend-builder, test-writer, copywriter
Root-cause debuggingopusdebugger, performance investigator
Planning, architecture, security reviewopusplanner, security-reviewer
Agents that should follow your /model choiceinheritgeneral helpers
.claude/agents/debugger.md
---
name: debugger
description: Use when a bug needs a root-cause fix. Reproduces first, then fixes, then proves it.
tools: Read, Grep, Glob, Bash, Edit
model: opus
---

1. Reproduce the bug with the smallest steps.
2. Find the root cause. Don't patch symptoms.
3. Fix it and re-run the reproduction.
Reply: cause (file:line), fix, proof.

Here's the debugger from our subagent examples, set to Opus because a wrong fix costs more than the tokens:

Effort and thinking: the other two dials

  • Effort: a subagent can set effort: (low, medium, high, xhigh or max) in its frontmatter. Low effort on Sonnet is often a better trade than high effort on Haiku. CLAUDE_CODE_EFFORT_LEVEL overrides it.
  • Extended thinking: subagents use the same thinking setting as your main conversation. There's no per-subagent switch.

Common problems

  • "My subagent ignores the model I set." Check CLAUDE_CODE_SUBAGENT_MODEL_FORCE, managed availableModels, and whether Claude passed a model when it started the subagent (that wins over the file).
  • "The env variable does nothing." Your agent files probably set model:, which wins. Remove the line or turn on FORCE.
  • "The /agents menu has no model picker." In current versions, /agents points you to the files. Edit the model: line directly or ask Claude to change it.
  • "Haiku results are too shallow." Move that agent up to sonnet. Don't move everything up.
  • "The alias gave a different version on Bedrock." Providers map aliases differently. Use a full model ID or the ANTHROPIC_DEFAULT_*_MODEL variables.

Ready-made subagents with models already chosen

Every agent in claudeagents comes with a model and tool list picked for its job: read-only auditors on smaller models, debuggers and planners on bigger ones. There are 85 agents across the coding, SEO and marketing kits. You can change any model: line, because they're plain Markdown files.

Frequently asked questions

What model does a Claude Code subagent use by default?

The same model as the conversation that starts it, unless its file sets model: or CLAUDE_CODE_SUBAGENT_MODEL is set.

How do I make a subagent use Haiku?

Add model: haiku to the frontmatter of its file in .claude/agents/. To use Haiku for one run only, ask Claude to run that subagent with haiku.

What does CLAUDE_CODE_SUBAGENT_MODEL do?

It sets the model for subagents and agent-team teammates that don't choose one another way. The model field and a model passed at start-up both win over it.

How do I force all subagents to use one model?

Set CLAUDE_CODE_SUBAGENT_MODEL to the model and CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 (v2.1.257+). Then the model field is ignored, except for model: inherit.

Can I use a full model ID in the model field?

Yes. Any value the --model flag accepts works, such as claude-sonnet-5-5. Use it to pin a version that won't change.

What does model: inherit mean?

The subagent uses the main conversation's model, or its parent subagent's model when nested. It follows /model switches.

Can I set the subagent model in settings.json?

Yes, through the env block: set CLAUDE_CODE_SUBAGENT_MODEL inside "env" in .claude/settings.json or ~/.claude/settings.json.

Sources

Skip the setup: get 85 ready-made agents

Coding, SEO and marketing kits for Claude Code, with 52 skills and 53 slash commands. $29 one-time, lifetime updates.

See what's included →

Keep reading