ToolSearch disabled when ANTHROPIC_BASE_URL is set — model check sees internal Haiku calls instead of primary model

Resolved 💬 3 comments Opened Mar 9, 2026 by kyzzen Closed Mar 12, 2026

Summary

ToolSearch is disabled when using ANTHROPIC_BASE_URL (e.g., Cloudflare AI Gateway proxy) because the model capability check resolves to claude-haiku-4-5-20251001 instead of the primary conversation model (claude-opus-4-6). Haiku doesn't support tool_reference blocks, so ToolSearch is disabled for the entire session — even though the main model fully supports it.

Reproduction

  1. Set ANTHROPIC_BASE_URL to a Cloudflare AI Gateway (or any pass-through proxy)
  2. Set ENABLE_TOOL_SEARCH to "true"
  3. Start a session on claude-opus-4-6
  4. Check debug logs

Debug output:

[DEBUG] [ToolSearch:optimistic] mode=tst, ENABLE_TOOL_SEARCH=true, result=true
[DEBUG] Tool search disabled for model 'claude-haiku-4-5-20251001': model does not support tool_reference blocks. This feature is only available on Claude Sonnet 4+, Opus 4+, and newer models.
  1. Without ANTHROPIC_BASE_URL, same session works correctly — ToolSearch activates.

Root Cause

Claude Code uses Haiku internally for lightweight operations (compaction, classification, subagent routing). When ANTHROPIC_BASE_URL is set, all requests — including internal Haiku calls — go through the same proxy. The ToolSearch model capability check picks up the Haiku model ID from these internal requests instead of evaluating against the primary conversation model.

Evidence from Cloudflare AI Gateway logs (same session, pass-through proxy, no dynamic routing):

| Time (UTC) | Model | Purpose |
|---|---|---|
| 07:29–07:31 | claude-opus-4-6 | Main conversation |
| 07:32–07:34 | claude-haiku-4-5-20251001 | Internal ops (subagents, compaction) |
| 07:34+ | claude-opus-4-6 | Main conversation resumes |

The gateway is a dumb pass-through — it's not modifying model IDs. Both model requests are legitimate Claude Code traffic.

Expected Behavior

ToolSearch should check capability against the primary conversation model, not internal Haiku calls. Since the user's session runs on Opus 4.6, ToolSearch should activate regardless of what models are used internally.

Environment

  • Claude Code version: latest (as of 2026-03-09)
  • Model: claude-opus-4-6
  • OS: Linux (WSL2)
  • ENABLE_TOOL_SEARCH: "true"
  • ANTHROPIC_BASE_URL: Cloudflare AI Gateway (pass-through, dynamic routing disabled)

Related Issues

  • #16925 — same debug message, likely same root cause
  • #15015 — tool_reference blocks unsupported on Haiku

View original on GitHub ↗

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