Web Search
Claude Web Search¶
This page explains how to enable the Web search tool for Anthropic Claude on the new API platform, allowing Claude to:
- Access live internet content: Answer questions beyond the model's knowledge cutoff date.
- Return answers with citations: Include web source links when possible for users to verify.
Key Notes:
- Notice: To use Claude Web Search, the token you are using must belong to theclaude codegroup. - Our Platform Gateway uniformly adopts the/v1/chat/completionsendpoint compatible with OpenAI specifications, triggering the networking capabilities of various models (including Claude) via theweb_search_optionsfield. - Anthropic Official has its native/v1/messagesendpoint and proprietaryweb_searchtool declaration methods (e.g.,web_search_20260209orweb_search_20250305).
Below, we will compare our platform's unified calling method with the Anthropic official calling method.
Quick Start¶
Our Platform Example¶
On this platform, you only need to send a request to the /v1/chat/completions endpoint and add the web_search_options field in the request body to enable the networking function.
curl "https://api-cs-al.naci-tech.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "claude-opus-4-5-20251101",
"messages": [
{
"role": "user",
"content": "What is the weather in Beijing tomorrow?"
}
],
"web_search_options": {
"search_context_size": "medium"
}
}'
web_search_options: The flag to enable web search. The currently supported configuration items (likesearch_context_sizewhich controls search context volume) are consistent with the networking mechanisms of other models such as GPT on the platform.
Anthropic Official Example (Native API)¶
If you are connecting directly to the Anthropic official API, you need to declare the native web_search tool through the tools array in the /v1/messages interface. Official tools are divided into basic and dynamic filtering versions:
curl "https://api.anthropic.com/v1/messages" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "What is the weather in NYC?"
}
],
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}
]
}'
Anthropic Official Advanced Features¶
Although you can easily solve the problem using web_search_options on our site, understanding the official native capabilities will help you grasp the potential of Claude Web Search.
Supported Models¶
According to Anthropic's official documentation, Web Search supports the following models:
claude-opus-4-6/claude-opus-4-5-20251101/claude-opus-4-1-20250805/claude-opus-4-20250514claude-sonnet-4-6/claude-sonnet-4-5-20250929/claude-sonnet-4-20250514claude-haiku-4-5-20251001
Dynamic Filtering and Tool Versions¶
The official native interface has two main versions:
web_search_20260209: The latest version, supports combining with code execution, allowing Claude to execute code on the server side to dynamically filter search results, keeping only truly relevant content in the context, thereby improving accuracy and reducing tokens.web_search_20250305: The basic version without dynamic filtering capabilities.
Official example enabling dynamic filtering:
curl "https://api.anthropic.com/v1/messages" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio."
}
],
"tools": [
{
"type": "web_search_20260209",
"name": "web_search"
},
{
"type": "code_execution",
"name": "code_execution"
}
]
}'
Official Parameters and Response Structure¶
If you are using the native interface, the web_search tool also supports the following parameters:
max_uses(optional): Limits the maximum number of searches that can be triggered in a single request; exceeding this will return amax_uses_exceedederror.allowed_domains(optional): Only allows results from these domains; domains do not include protocols and will automatically include subdomains.blocked_domains(optional): Prohibits results from these domains; cannot be used concurrently withallowed_domains.user_location(optional): Used to localize search results, including information such as city, region, country, and timezone.
The native response will appear as server_tool_use and web_search_tool_result content blocks, and include a citations structure to support specific source display. However, when called on this platform using /v1/chat/completions, the gateway processes this in the background and returns the organized results either as plain text concatenation or through a compatible Citation format.
Summary¶
- Using on our site: Please call
/v1/chat/completionsdirectly and passweb_search_options. This is completely consistent with calling the networking functions of GPT and other open-source models, eliminating the need to handle complex native Tool call logic. - Direct official connection: Please follow the official documentation to call
/v1/messagesand declareweb_search_20250305orweb_search_20260209(with filtering) in thetoolsarray.