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-4-5-20250929-v1:0
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-4-5-20250929-v1:0
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-1234
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

Configure which search provider to use. LiteLLM supports multiple search providers:

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

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-4-5-20250929-v1:0
aws_region_name: us-east-1

- model_name: azure-gpt4
litellm_params:
model: azure/gpt-4
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)