[BUG] Deferred custom tools break non-Anthropic models behind custom ANTHROPIC_BASE_URL
Summary
Claude Code enables deferred tool loading / ToolSearch when used through a custom ANTHROPIC_BASE_URL.
When the backend serves a non-Anthropic model that supports normal tool calling but does not implement Anthropic's deferred custom tool protocol, Claude Code can fail with:
API Error: 400 Deferred custom tools are only supported on Anthropic models and on Anthropic-compatible
provider endpoints that implement deferral. Other endpoints cannot call tools omitted from tools[].
Received stealth/ox-alpha.
In some agentic tasks, the symptom can also look less obvious: Claude Code works for several seconds, returns to the prompt before the task is finished, and the user has to repeatedly type continue.
Environment
- Claude Code:
2.1.241 - Platform:
win32-x64 - Installation: npm global
- Custom endpoint configured through
ANTHROPIC_BASE_URL - Model:
stealth/ox-alpha - Operating system: Windows
- Claude Code doctor reports:
ANTHROPIC_BASE_URL is set and does not point at api.anthropic.com
Reproduction
- Configure Claude Code to use a custom Anthropic-compatible endpoint via
ANTHROPIC_BASE_URL. - Use a non-Anthropic model supporting standard tool calling, e.g.
stealth/ox-alpha. - Start Claude Code normally.
- Send a prompt that causes Claude Code to use a deferred tool.
- Claude Code returns:
API Error: 400 Deferred custom tools are only supported on Anthropic models and on Anthropic-compatible
provider endpoints that implement deferral. Other endpoints cannot call tools omitted from tools[].
Received stealth/ox-alpha.
Root Cause
Claude Code can use ToolSearch/deferred tool loading, meaning some tool definitions are omitted from the initial tools[] request and loaded later.
This requires support for Anthropic's deferred tool semantics.
A backend/model may support ordinary Anthropic-style tool calling while not supporting deferred custom tools. In that case, Claude Code's deferred tool mode is incompatible with the endpoint.
Workaround
Disable ToolSearch / deferred loading:
PowerShell
$env:ENABLE_TOOL_SEARCH="false"
claude
Or configure it persistently in Claude Code settings:
{
"env": {
"ENABLE_TOOL_SEARCH": "false"
}
}
With ToolSearch disabled, tools are provided normally instead of relying on deferred loading.
Expected Behavior
For a custom ANTHROPIC_BASE_URL, Claude Code should either:
- detect whether the provider supports deferred custom tools before enabling ToolSearch; or
- automatically fall back to standard/eager tool loading if deferred tools are unsupported; or
- provide a clear startup warning explaining that
ENABLE_TOOL_SEARCH=falseis required.
Ideally, users should not encounter this only after an agent attempts to invoke a deferred tool.
Additional Context
This is especially confusing because the endpoint/model may otherwise support normal tool calling correctly. The failure is specifically related to deferred tool definitions rather than tool calling in general.