litellm - 💡(How to fix) Fix websearch_interception does not fire for Claude Code + Bedrock pass-through; PR #25242 would fix the root cause but introduces a new Bedrock skip that re-breaks it [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26252Fetched 2026-04-23 07:24:19
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×2commented ×1renamed ×1

Error Message

Bedrock Converse rejects it with a validation error that enumerates accepted type tags: Error surfaced through the proxy: 2. In the same PR, narrow the native-provider skip introduced in commit 05ddb2e to anthropic only. Bedrock and Vertex AI should go through the interception path the same as other providers, since neither handles web_search_20250305 server-side. (I'm less certain about Vertex's current state — happy to be corrected there — but the Bedrock case is unambiguous from AWS's own error message.)

Root Cause

Routing Claude Code through LiteLLM to AWS Bedrock via ANTHROPIC_BASE_URL with websearch_interception configured, the interception short-circuit never fires. The web_search_20250305 tool is forwarded to Bedrock, which rejects it because Bedrock does not support that tool on any API path.

Code Example

tools.0: Input tag 'web_search_20250305' found using 'type' does not match
any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124'

---

model_list:
  - model_name: claude-sonnet-4-5-20250929
    litellm_params:
      model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
      aws_region_name: us-east-1

litellm_settings:
  callbacks:
    - websearch_interception:
        enabled_providers: [bedrock]

search_tools:
  - search_tool_name: searxng-search
    litellm_params:
      search_provider: searxng
      api_base: http://searxng.internal:8080

---

{"message":"The provided request is not valid"}. Received Model Group=claude-haiku-4-5-20251001
Available Model Group Fallbacks=None
RAW_BUFFERClick to expand / collapse

Describe the bug

Routing Claude Code through LiteLLM to AWS Bedrock via ANTHROPIC_BASE_URL with websearch_interception configured, the interception short-circuit never fires. The web_search_20250305 tool is forwarded to Bedrock, which rejects it because Bedrock does not support that tool on any API path.

There are two related problems here, which I want to separate clearly:

Problem 1 (current, v1.83.7-stable): On main today, interception does not fire for Claude Code's web_search_20250305 request shape when routed through the Bedrock pass-through. This appears to be a tool-name / request-format compatibility gap — Claude Code sends the tool as {"type": "web_search_20250305", "name": "web_search"}, but the interception detection logic in current main doesn't recognize this as a search-only request that should be short-circuited. Related context in #21733 (adapter path) and #20179 (tool name detection on v1.81.3).

Problem 2 (pending, PR #25242): PR #25242 is attempting to fix the Claude Code compatibility gap — renaming the injected tool name to WebSearch, returning native Anthropic format (server_tool_use + web_search_tool_result), and adding streaming support for those block types. This would resolve Problem 1. However, commit 05ddb2e within that same PR ("Restore native provider skip for upstream compatibility") adds an unconditional skip for anthropic, bedrock, and vertex_ai, on the premise that these providers "handle web_search_20250305 natively." This premise is false for Bedrock.

If #25242 merges as currently structured, it will fix the Claude Code compatibility path but simultaneously make enabled_providers: [bedrock] a no-op — the very scenario the docs (Claude Code - WebSearch Across All Providers) explicitly advertise as supported.

Ground truth on Bedrock's support for web_search_20250305

Bedrock Converse rejects it with a validation error that enumerates accepted type tags:

tools.0: Input tag 'web_search_20250305' found using 'type' does not match
any of the expected tags: 'bash_20250124', 'custom', 'text_editor_20250124'

Sources:

To Reproduce

  1. Set ANTHROPIC_BASE_URL pointing to a LiteLLM proxy backed by AWS Bedrock.
  2. Configure websearch_interception with enabled_providers: [bedrock] and a search provider (SearXNG, Tavily, etc.).
  3. Trigger a web search from Claude Code.
  4. Observe: the web_search tool definition is forwarded to Bedrock unintercepted; Bedrock returns a 400.

Minimal config:

model_list:
  - model_name: claude-sonnet-4-5-20250929
    litellm_params:
      model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
      aws_region_name: us-east-1

litellm_settings:
  callbacks:
    - websearch_interception:
        enabled_providers: [bedrock]

search_tools:
  - search_tool_name: searxng-search
    litellm_params:
      search_provider: searxng
      api_base: http://searxng.internal:8080

Error surfaced through the proxy:

{"message":"The provided request is not valid"}. Received Model Group=claude-haiku-4-5-20251001
Available Model Group Fallbacks=None

Expected behavior

When enabled_providers includes bedrock, the interception short-circuit should execute for Bedrock-routed requests. Bedrock cannot handle web_search_20250305 natively on any API path, so the interception layer needs to run the search via the configured provider and return results in Anthropic-compatible format before the request reaches Bedrock.

Proposed fix

Two things need to both happen:

  1. Land the Claude Code compatibility changes in #25242 (tool-name alignment, native-format response, streaming support for server_tool_use / web_search_tool_result blocks). These are correct and necessary.
  2. In the same PR, narrow the native-provider skip introduced in commit 05ddb2e to anthropic only. Bedrock and Vertex AI should go through the interception path the same as other providers, since neither handles web_search_20250305 server-side. (I'm less certain about Vertex's current state — happy to be corrected there — but the Bedrock case is unambiguous from AWS's own error message.)

Environment

  • LiteLLM version: v1.83.7-stable
  • Client: Claude Code (via ANTHROPIC_BASE_URL → LiteLLM)
  • Backend: AWS Bedrock (bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0, claude-haiku-4-5-20251001-v1:0)

Related

  • PR #25242 — the fix-in-progress and the source of the pending regression
  • #21733 — adapter vs. base handler path distinction for agentic loop hooks
  • #20179 — tool-name detection / spend tracking on v1.81.3
  • #20187 — zero output tokens when interception does fire on Bedrock (pre-#25242)

extent analysis

TL;DR

The proposed fix involves landing the Claude Code compatibility changes in PR #25242 and narrowing the native-provider skip to anthropic only, allowing Bedrock and Vertex AI to go through the interception path.

Guidance

  • Review PR #25242 and ensure the Claude Code compatibility changes are correctly implemented, including tool-name alignment, native-format response, and streaming support for server_tool_use / web_search_tool_result blocks.
  • Modify the native-provider skip introduced in commit 05ddb2e to only apply to anthropic, allowing Bedrock and Vertex AI to use the interception path.
  • Verify that the interception short-circuit executes correctly for Bedrock-routed requests when enabled_providers includes bedrock.
  • Test the changes with the provided minimal config and observe that the web_search tool definition is intercepted and executed via the configured provider.

Example

No code snippet is provided as the issue is more related to configuration and PR changes.

Notes

The fix assumes that Vertex AI does not handle web_search_20250305 server-side, but this is not explicitly confirmed in the issue. Additional verification may be necessary to ensure the changes work correctly for Vertex AI.

Recommendation

Apply the workaround by modifying PR #25242 to narrow the native-provider skip to anthropic only, allowing Bedrock and Vertex AI to use the interception path. This should resolve the issue and prevent the pending regression.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING