[BUG] Model override with --model switch is incomplete, does not change models used by WebFetch, or generic sub-agent

Resolved 💬 6 comments Opened Sep 6, 2025 by DmitriyAlergant Closed Jan 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code already allows to select a custom main model via ``--model`` switch, which is relevant for users relying API-based access (e.g. via LiteLLM or another proxy) in certain environments where the Sonnet and Opus models may not be available, or may be known under different handles, or a user wants to try an alternative cheaper model.

However the feature is incomplete, and Claude still defaults to hardcoded Anthropic models in some scenarios.

1) general-purpose subagent (as mentioned in https://github.com/anthropics/claude-code/issues/5146) is Sonnet by default. Therefore if Sonnet model is not available via API under that exact name, the task is failing

2) Web Fetch task (and possibly some other tasks?) seems to hardcode ``claude-3-5-haiku-20241022`` model for page summarization, and I see no way whatsoever to override that.

What Should Happen?

When the main model was overridden with --model, Claude should default to using that model also for sub-agents, and for all auxiliary tasks - no hardcoding of forced model choices.

Ideally, implement an additional switch like ``--aux-model`` allowing a user to specify an alternative cheaper model for such tasks, following the original intention of using an efficient fast model.

Error Messages/Logs

API Error: 400 {"error":{"message":"400: {'error': 'completion: Invalid model name passed in model=claude-3-5-haiku-20241022'}","type":"None","param":"None","code":"400"}}

Steps to Reproduce

export ANTHROPIC_BASE_URL=http://localhost:4000
export ANTHROPIC_AUTH_TOKEN=.....
export IS_SANDBOX=1
echo "when has Pope Francis died? use WebFetch to read at least one article fully" | claude -p --verbose --output-format stream-json --dangerously-skip-permissions \
  --model gemini-2.5-flash

Getting errors explicitly mentioning haiku, which was not the requested model and not currently available on the gateway (intentionally)

{"type":"user","message":{"role":"user","content":[{"tool_use_id":"toolu_01Vn1U9NT2HsnGzYsbpP3Ua1","type":"tool_result","content":"API Error: 400 {\"error\":{\"message\":\"400: {'error': 'completion: Invalid model name passed in model=claude-3-5-haiku-20241022'}\",\"type\":\"None\",\"param\":\"None\",\"code\":\"400\"}}"}]},"parent_tool_use_id":null,"session_id":"f7c542e3-3b0b-4bbb-84cc-f618b31d67db","uuid":"8b6750e9-f1ed-4dfe-87a6-8755e98152e5"}

Claude Model

Other

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

1.0.108

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗