Skip to main content

Claude Code - WebSearch Across All Providers

Enable Claude Code's web search tool to work with any provider (Bedrock, Azure, Vertex, etc.). LiteLLM automatically intercepts web search requests and executes them server-side.

Proxy Configuration​

Add WebSearch interception to your litellm_config.yaml:

litellm_config.yaml
model_list:
- model_name: bedrock-sonnet
litellm_params:
model: bedrock/us.anthropic.claude-sonnet-5
aws_region_name: us-east-1

# Enable WebSearch interception for providers
litellm_settings:
callbacks: ["websearch_interception"]
websearch_interception_params:
enabled_providers:
- bedrock
- azure
- vertex_ai
search_tool_name: perplexity-search # Optional: specific search tool

# Configure search provider
search_tools:
- search_tool_name: perplexity-search
litellm_params:
search_provider: perplexity
api_key: os.environ/PERPLEXITY_API_KEY

Quick Start​

1. Configure LiteLLM Proxy​

Create config.yaml:

config.yaml
model_list:
- model_name: bedrock-sonnet
litellm_params:
model: bedrock/us.anthropic.claude-sonnet-5
aws_region_name: us-east-1

litellm_settings:
callbacks: ["websearch_interception"]
websearch_interception_params:
enabled_providers: [bedrock]

search_tools:
- search_tool_name: perplexity-search
litellm_params:
search_provider: perplexity
api_key: os.environ/PERPLEXITY_API_KEY

To use Parallel Search instead, set PARALLEL_API_KEY and replace the litellm_settings and search_tools sections:

Parallel Search configuration
litellm_settings:
callbacks: ["websearch_interception"]
websearch_interception_params:
enabled_providers: [bedrock]
search_tool_name: parallel-search

search_tools:
- search_tool_name: parallel-search
litellm_params:
search_provider: parallel_ai
api_key: os.environ/PARALLEL_API_KEY

2. Start Proxy​

Start LiteLLM Proxy
# For Parallel Search, export PARALLEL_API_KEY=your-key instead.
export PERPLEXITY_API_KEY=your-key
litellm --config config.yaml

3. Use with Claude Code​

Configure Claude Code
export ANTHROPIC_BASE_URL=http://localhost:4000
export ANTHROPIC_API_KEY=sk-<your-api-key>
claude

Now use web search in Claude Code - it works with any provider!

How It Works​

When Claude Code sends a web search request, LiteLLM:

  1. Intercepts the native web_search tool
  2. Converts it to LiteLLM's standard format
  3. Executes the search using the configured provider, such as Parallel, Perplexity, or Tavily
  4. Returns the final answer to Claude Code

Result: One API call from Claude Code → Complete answer with search results

Supported Providers​

ProviderNative Web SearchWith LiteLLM
Anthropic✅ Yes✅ Yes
Bedrock❌ No✅ Yes
Azure❌ No✅ Yes
Vertex AI❌ No✅ Yes
Other Providers❌ No✅ Yes

Search Providers​

Any search provider LiteLLM supports can run Claude Code's web searches. Set its search_provider value in search_tools:

Providersearch_provider ValueEnvironment Variable
Perplexity AIperplexityPERPLEXITYAI_API_KEY
TavilytavilyTAVILY_API_KEY
Exa AIexa_aiEXA_API_KEY
Parallel AIparallel_aiPARALLEL_AI_API_KEY
Google PSEgoogle_pseGOOGLE_PSE_API_KEY, GOOGLE_PSE_ENGINE_ID
DataForSEOdataforseoDATAFORSEO_LOGIN, DATAFORSEO_PASSWORD
FirecrawlfirecrawlFIRECRAWL_API_KEY
SearXNGsearxngSEARXNG_API_BASE (required)
LinkuplinkupLINKUP_API_KEY
Brave SearchbraveBRAVE_API_KEY
fastCRWfastcrwCRW_API_KEY
DuckDuckGoduckduckgoNone
SearchAPI.iosearchapiSEARCHAPI_API_KEY
SerperserperSERPER_API_KEY
You.comyou_comYOUCOM_API_KEY (optional)
APISerpentapiserpentAPISERPENT_API_KEY
TinyFishtinyfishTINYFISH_API_KEY
Bedrock AgentCoreagentcoreAGENTCORE_GATEWAY_URL, AWS credentials or AGENTCORE_GATEWAY_TOKEN
NimblenimbleNIMBLE_API_KEY
Grounding with Bingbing_groundingBING_GROUNDING_PROJECT_ENDPOINT, BING_GROUNDING_MODEL, Azure credentials or BING_GROUNDING_TOKEN
DeepSeekdeepseekDEEPSEEK_API_KEY
xAI X Search (from v1.109.0)xaiXAI_API_KEY

See all supported search providers for detailed setup instructions and provider-specific parameters.

Configuration Options​

WebSearch Interception Parameters​

ParameterTypeRequiredDescriptionExample
enabled_providersList[String]YesList of providers to enable web search interception for[bedrock, azure, vertex_ai]
search_tool_nameStringNoSpecific search tool from search_tools config. If not set, uses first available search tool.perplexity-search

Supported Provider Values​

Use these values in enabled_providers:

ProviderValueDescription
AWS BedrockbedrockAmazon Bedrock Claude models
Azure OpenAIazureAzure-hosted models
Google Vertex AIvertex_aiGoogle Cloud Vertex AI
Any OtherProvider nameAny LiteLLM-supported provider

Complete Configuration Example​

Complete config.yaml
model_list:
- model_name: bedrock-sonnet
litellm_params:
model: bedrock/us.anthropic.claude-sonnet-5
aws_region_name: us-east-1

- model_name: azure-gpt
litellm_params:
model: azure/gpt-6.1-sol
api_base: https://my-azure.openai.azure.com
api_key: os.environ/AZURE_API_KEY

litellm_settings:
callbacks: ["websearch_interception"]
websearch_interception_params:
enabled_providers:
- bedrock # Enable for AWS Bedrock
- azure # Enable for Azure OpenAI
- vertex_ai # Enable for Google Vertex
search_tool_name: perplexity-search # Optional: use specific search tool

# Configure search tools
search_tools:
- search_tool_name: perplexity-search
litellm_params:
search_provider: perplexity
api_key: os.environ/PERPLEXITY_API_KEY

- search_tool_name: tavily-search
litellm_params:
search_provider: tavily
api_key: os.environ/TAVILY_API_KEY

How search tool selection works:

  • If search_tool_name is specified → Uses that specific search tool
  • If search_tool_name is not specified → Uses first search tool in search_tools list
  • In example above: Without search_tool_name, would use perplexity-search (first in list)