Summary
On Claude Code 2.1.177, setting CLAUDE_CODE_SUBAGENT_MODEL=inherit causes dispatched subagents to ignore the per-call model parameter and always run the main session model. The model-config docs state inherit means "use normal model resolution," and the sub-agents docs rank the per-invocation model param above the session model — so per-call routing should work with inherit. It does not. Unsetting the variable entirely makes it work as documented.
Environment
- Claude Code 2.1.177, Windows 11
settings.json: top-level "model": "opus", env "CLAUDE_CODE_SUBAGENT_MODEL": "inherit"
Repro
settings.json -> "model": "opus", env "CLAUDE_CODE_SUBAGENT_MODEL": "inherit". Restart Claude Code.
- Dispatch a subagent (Task tool) with
model: "haiku" (or "sonnet").
- Inspect the subagent transcript
~/.claude/projects/<proj>/<session>/subagents/agent-<id>.jsonl and grep "model".
Actual
model:"haiku" and model:"sonnet" both ran claude-opus-4-8 (the session model). The per-call param is dropped — it is not even recorded in the subagent transcript.
Expected
Per the documented precedence (per-invocation model param > session model; inherit = normal resolution), the subagent should run claude-haiku-4-5.
What actually works
Removing CLAUDE_CODE_SUBAGENT_MODEL entirely (unset) + restart -> model:"haiku" correctly runs claude-haiku-4-5-20251001. So inherit does not behave like "unset," contrary to the docs.
Fix (either resolves it)
- Code: make
inherit defer to the per-call model param as documented; or
- Docs: clarify that
inherit forces the session model and the variable must be unset for the per-call model to be honored.
Impact
Silent cost blow-up — orchestrator-intended haiku/sonnet subagents all silently ran Opus.
Summary
On Claude Code 2.1.177, setting
CLAUDE_CODE_SUBAGENT_MODEL=inheritcauses dispatched subagents to ignore the per-callmodelparameter and always run the main session model. The model-config docs stateinheritmeans "use normal model resolution," and the sub-agents docs rank the per-invocationmodelparam above the session model — so per-call routing should work withinherit. It does not. Unsetting the variable entirely makes it work as documented.Environment
settings.json: top-level"model": "opus", env"CLAUDE_CODE_SUBAGENT_MODEL": "inherit"Repro
settings.json->"model": "opus", env"CLAUDE_CODE_SUBAGENT_MODEL": "inherit". Restart Claude Code.model: "haiku"(or"sonnet").~/.claude/projects/<proj>/<session>/subagents/agent-<id>.jsonland grep"model".Actual
model:"haiku"andmodel:"sonnet"both ranclaude-opus-4-8(the session model). The per-call param is dropped — it is not even recorded in the subagent transcript.Expected
Per the documented precedence (per-invocation
modelparam > session model;inherit= normal resolution), the subagent should runclaude-haiku-4-5.What actually works
Removing
CLAUDE_CODE_SUBAGENT_MODELentirely (unset) + restart ->model:"haiku"correctly runsclaude-haiku-4-5-20251001. Soinheritdoes not behave like "unset," contrary to the docs.Fix (either resolves it)
inheritdefer to the per-callmodelparam as documented; orinheritforces the session model and the variable must be unset for the per-callmodelto be honored.Impact
Silent cost blow-up — orchestrator-intended haiku/sonnet subagents all silently ran Opus.