-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
Built-in agents (like Explore, claude-code-guide, etc.) ignore the ANTHROPIC_SMALL_FAST_MODEL environment variable configured in ~/.claude/settings.json and instead use hardcoded model names like "haiku" which get mapped to claude-haiku-4-5-20251001 instead of the configured custom model.
This causes authentication errors when using custom model endpoints (e.g., Vertex AI, Bedrock, or proxy services) that require specific model identifiers.
What Should Happen?
Built-in agents should:
- Respect ANTHROPIC_SMALL_FAST_MODEL when using model: "haiku"
- OR allow custom agents to override built-in agents
- OR provide a way to configure model mapping for short names like "haiku", "sonnet", "opus"
Error Messages/Logs
Built-in agents have hardcoded model strings like:
LL={
agentType:"Explore",
// ...
model:"haiku", // <- Hardcoded
// ...
}
This "haiku" gets mapped to claude-haiku-4-5-20251001 instead of mine.Steps to Reproduce
-
Configure custom model in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_MODEL": "custom/claude-sonnet-4-5",
"ANTHROPIC_SMALL_FAST_MODEL": "custom/claude-haiku-4-5",
"ANTHROPIC_BASE_URL": "https://custom.proxy.url/"
}
} -
Use the Task tool with a built-in agent:
Task(
subagent_type="Explore",
prompt="Find all .sh files in the lxc/ directory"
) -
Observe the error:
API Error: 401 {"error":{"message":"team not allowed to access model.
Tried to access claude-haiku-4-5-20251001",...}}
Claude Model
Other
Is this a regression?
No, this never worked
Last Working Version
No response
Claude Code Version
2.0.76
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
In /node_modules/@anthropic-ai/claude-code/cli.js line 2067:
LL={
agentType:"Explore",
whenToUse:'Fast agent specialized for exploring codebases...',
disallowedTools:[n3,mJ1,j3,FI,lM],
source:"built-in",
baseDir:"built-in",
model:"haiku", // <- Problem: hardcoded
getSystemPrompt:()=>Jg5,
// ...
}
Similarly for claude-code-guide agent (line 623):
QCB={
agentType:ln1,
whenToUse:'Use this agent when the user asks questions...',
tools:[qV,OX,T3,VI,iM],
source:"built-in",
baseDir:"built-in",
model:"haiku", // ← Same issue
// ...
}
Workaround
Manual patch of cli.js:
Backup
cp cli.js cli.js.backup
Patch Explore agent
sed -i 's/model:"haiku"/model:"custom/claude-haiku-4-5"/' cli.js
Note: This workaround is fragile and breaks on each update.
Proposed Solutions
- Option A: Make built-in agents respect ANTHROPIC_SMALL_FAST_MODEL:
model: process.env.ANTHROPIC_SMALL_FAST_MODEL || "haiku" - Option B: Allow custom agents in ~/.claude/agents/ to override built-in agents with the same name
- Option C: Add a configuration option for model mapping:
{
"modelMapping": {
"haiku": "custom/claude-haiku-4-5",
"sonnet": "custom/claude-sonnet-4-5",
"opus": "custom/claude-opus-4-5"
}
} - Option D: Make agents use model: "inherit" by default instead of hardcoded values
Impact
This bug prevents users from:
- Using Claude Code with Vertex AI or Bedrock
- Using custom LLM proxy services
- Deploying Claude Code in enterprise environments with custom model routing
Additional Context
The Task tool does have a model parameter, but it only accepts short names ("haiku", "sonnet", "opus"), not full model identifiers like "custom/claude-haiku-4-5".