From fe555bd08fd4af8ed3cfd2e6da43d80b93c6494b Mon Sep 17 00:00:00 2001 From: Vigilans Date: Tue, 21 Apr 2026 21:51:06 +0800 Subject: [PATCH] fix(adapter): pass allowed_domains through web_search_options to Responses API When translating Anthropic web_search tools to chat/completions format, allowed_domains was silently dropped (web_search_options set to {}). Now extract allowed_domains from the tool and pass it as filters.allowed_domains in web_search_options, which the Responses API bridge forwards to the web_search tool. --- .../experimental_pass_through/adapters/transformation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index 5fd22424180..3f85a4efcc3 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -1049,7 +1049,13 @@ class LiteLLMAnthropicMessagesAdapter: regular_tools.append(cast(AllAnthropicToolsValues, tool)) if web_search_tools: - new_kwargs["web_search_options"] = {} # type: ignore + web_search_options: Dict[str, Any] = {} + for wst in web_search_tools: + wst_dict = cast(Dict[str, Any], wst) + allowed = wst_dict.get("allowed_domains") + if allowed: + web_search_options.setdefault("filters", {})["allowed_domains"] = allowed + new_kwargs["web_search_options"] = web_search_options # type: ignore if not regular_tools: # No regular tools left — drop tool_choice to avoid