SPB Git

Repository Public

web-search-tool.md 27.6 KB 690 lines markdown

1---2title: Web search tool3url: https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool4description: Give Claude access to current web content with cited sources, optional dynamic filtering, and domain controls.5---67<Note>8  To learn how zero data retention (ZDR) applies to this feature, see [API and data retention](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention).9</Note>1011The web search tool gives Claude direct access to real-time web content, allowing it to answer questions with up-to-date information beyond its knowledge cutoff. The response includes citations for sources drawn from search results.1213With `web_search_20260209` and later versions, Claude can write and run code that filters the search results before they reach the context window (**dynamic filtering**), keeping only relevant information. Dynamic filtering is available with Claude 4.6 and later models and [Claude Mythos Preview](https://anthropic.com/glasswing).1415Three versions of the web search tool are available:1617* `web_search_20250305`: basic web search18* `web_search_20260209`: adds [dynamic filtering](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#dynamic-filtering)19* `web_search_20260318`: adds [response inclusion](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#response-inclusion) control for agentic workflows2021The examples on this page use `web_search_20250305` for basic search and `web_search_20260318` for dynamic filtering.2223<Note>24  For [Claude Mythos Preview](https://anthropic.com/glasswing), web search is supported on the Claude API, Google Cloud, and Microsoft Foundry. Web search is not available for Mythos Preview on Amazon Bedrock or [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws).25</Note>2627For web search's Zero Data Retention eligibility and the related `allowed_callers` configuration, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#zdr-and-allowed-callers).2829For model support, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference).3031## How web search works3233When you add the web search tool to your API request:34351. Claude determines when to search based on the prompt.362. The API runs the searches and provides Claude with the results. This process can repeat multiple times throughout a single request.373. At the end of its turn, Claude provides a final response with cited sources.3839### When Claude searches4041Claude searches when the request depends on information that is current, changing, or outside its training data:4243* Recent events, news, or announcements44* Current prices, rates, scores, or statistics45* Information about specific organizations, people, or products that might have changed46* Explicit requests to search or look something up4748Claude answers directly without searching when the request draws on stable knowledge:4950* Established facts, math, science fundamentals, or coding concepts51* Creative writing or brainstorming52* Analysis of content already provided in the conversation53* Conversational turns and greetings5455Triggering is steerable through your system prompt: you can encourage Claude to search more readily or to prefer answering directly. For a hard constraint, use `max_uses` to cap the number of searches for each request.5657### Dynamic filtering5859With basic web search, every search result is loaded into Claude's context window, and much of that content can be irrelevant to the request. With `web_search_20260209` or later, Claude instead writes and runs code that filters the results first, so only relevant content reaches the context window. This reduces token use on search-heavy requests.6061Dynamic filtering runs web search from inside [code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool): on `web_search_20260209` and later, the tool's `allowed_callers` field defaults to `["code_execution_20260120"]`, and when dynamic filtering runs, the API provisions the code execution it needs for the request automatically. You don't need to add the code execution tool to `tools` yourself. There are no additional charges for code execution calls made this way beyond the standard token costs.6263To call web search directly, without dynamic filtering, set `allowed_callers: ["direct"]`. Models that don't support programmatic tool calling require this setting. Without it, the API returns a 400 error that tells you to set it.6465<Note>66  The web search tool (with and without dynamic filtering) is available on the Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws), and [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry). On Microsoft Foundry, deployments [hosted on Azure](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#additional-features-not-supported-when-hosted-on-azure) support only the basic web search tool (`web_search_20250305`, without dynamic filtering). Deployments hosted on Anthropic support all versions. On Google Cloud, only the basic web search tool (without dynamic filtering) is available. Web search is not available on Amazon Bedrock.67</Note>6869The following examples use `web_search_20260318`:7071<CodeGroup>72  ```bash cURL73  curl https://api.anthropic.com/v1/messages \74    -H "x-api-key: $ANTHROPIC_API_KEY" \75    -H "anthropic-version: 2023-06-01" \76    -H "content-type: application/json" \77    -d '{78      "model": "claude-opus-5",79      "max_tokens": 4096,80      "messages": [81        {82          "role": "user",83          "content": "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio."84        }85      ],86      "tools": [{87        "type": "web_search_20260318",88        "name": "web_search"89      }]90    }'91  ```9293  ```bash CLI94  ant messages create <<'YAML'95  model: claude-opus-596  max_tokens: 409697  messages:98    - role: user99      content: >-100        Search for the current prices of AAPL and GOOGL, then calculate101        which has a better P/E ratio.102  tools:103    - type: web_search_20260318104      name: web_search105  YAML106  ```107108  ```python Python109  client = anthropic.Anthropic()110111  response = client.messages.create(112      model="claude-opus-5",113      max_tokens=4096,114      messages=[115          {116              "role": "user",117              "content": "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.",118          }119      ],120      tools=[{"type": "web_search_20260318", "name": "web_search"}],121  )122  print(response)123  ```124125  ```typescript TypeScript126  const client = new Anthropic();127128  const response = await client.messages.create({129    model: "claude-opus-5",130    max_tokens: 4096,131    messages: [132      {133        role: "user",134        content:135          "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio."136      }137    ],138    tools: [{ type: "web_search_20260318", name: "web_search" }]139  });140141  console.log(response);142  ```143144  ```csharp C#145  AnthropicClient client = new();146147  var parameters = new MessageCreateParams148  {149      Model = Model.ClaudeOpus5,150      MaxTokens = 4096,151      Messages = [new() { Role = Role.User, Content = "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio." }],152      Tools = [new ToolUnion(new WebSearchTool20260318())]153  };154155  var message = await client.Messages.Create(parameters);156  Console.WriteLine(message);157  ```158159  ```go Go160  client := anthropic.NewClient()161162  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{163  	Model:     anthropic.ModelClaudeOpus5,164  	MaxTokens: 4096,165  	Messages: []anthropic.MessageParam{166  		anthropic.NewUserMessage(anthropic.NewTextBlock("Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.")),167  	},168  	Tools: []anthropic.ToolUnionParam{169  		{OfWebSearchTool20260318: &anthropic.WebSearchTool20260318Param{}},170  	},171  })172  if err != nil {173  	log.Fatal(err)174  }175  fmt.Println(response)176  ```177178  ```java Java179  import com.anthropic.models.messages.WebSearchTool20260318;180181  void main() {182      AnthropicClient client = AnthropicOkHttpClient.fromEnv();183184      MessageCreateParams params = MessageCreateParams.builder()185          .model(Model.CLAUDE_OPUS_5)186          .maxTokens(4096L)187          .addUserMessage("Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.")188          .addTool(WebSearchTool20260318.builder().build())189          .build();190191      Message response = client.messages().create(params);192      IO.println(response);193  }194  ```195196  ```php PHP197  $client = new Client();198199  $message = $client->messages->create(200      maxTokens: 4096,201      messages: [202          ['role' => 'user', 'content' => 'Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio.'],203      ],204      model: 'claude-opus-5',205      tools: [206          [207              'type' => 'web_search_20260318',208              'name' => 'web_search',209          ],210      ],211  );212213  echo $message;214  ```215216  ```ruby Ruby217  client = Anthropic::Client.new218219  message = client.messages.create(220    model: "claude-opus-5",221    max_tokens: 4096,222    messages: [223      { role: "user", content: "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio." }224    ],225    tools: [{226      type: "web_search_20260318",227      name: "web_search"228    }]229  )230  puts message231  ```232</CodeGroup>233234## How to use web search235236<Note>237  Web search is enabled for your organization unless an administrator has disabled it in the [Claude Console](https://platform.claude.com/settings/privacy), where they can also restrict which domains it searches. If it's disabled, a request that includes the tool fails with a 400 `invalid_request_error` that says web search is not enabled, rather than an [error code](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#errors) inside a search result.238</Note>239240These organization-level settings in the Claude Console apply to Messages API requests only. [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) sessions use only the per-tool `allowed_domains` and `blocked_domains` lists on the agent toolset; see [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools#restrict-web-search-and-web-fetch-domains).241242Provide the web search tool in your API request:243244<CodeGroup>245  ```bash cURL246  curl https://api.anthropic.com/v1/messages \247    -H "x-api-key: $ANTHROPIC_API_KEY" \248    -H "anthropic-version: 2023-06-01" \249    -H "content-type: application/json" \250    -d '{251      "model": "claude-opus-5",252      "max_tokens": 1024,253      "messages": [254        {255          "role": "user",256          "content": "What is the weather in NYC?"257        }258      ],259      "tools": [{260        "type": "web_search_20250305",261        "name": "web_search",262        "max_uses": 5263      }]264    }'265  ```266267  ```bash CLI268  ant messages create \269    --model claude-opus-5 \270    --max-tokens 1024 \271    --message '{role: user, content: What is the weather in NYC?}' \272    --tool '{type: web_search_20250305, name: web_search, max_uses: 5}'273  ```274275  ```python Python276  client = anthropic.Anthropic()277278  response = client.messages.create(279      model="claude-opus-5",280      max_tokens=1024,281      messages=[{"role": "user", "content": "What's the weather in NYC?"}],282      tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}],283  )284  print(response)285  ```286287  ```typescript TypeScript288  const client = new Anthropic();289290  const response = await client.messages.create({291    model: "claude-opus-5",292    max_tokens: 1024,293    messages: [294      {295        role: "user",296        content: "What's the weather in NYC?"297      }298    ],299    tools: [300      {301        type: "web_search_20250305",302        name: "web_search",303        max_uses: 5304      }305    ]306  });307308  console.log(response);309  ```310311  ```csharp C#312  AnthropicClient client = new();313314  var parameters = new MessageCreateParams315  {316      Model = Model.ClaudeOpus5,317      MaxTokens = 1024,318      Messages = [new() { Role = Role.User, Content = "What's the weather in NYC?" }],319      Tools = [new ToolUnion(new WebSearchTool20250305() { MaxUses = 5 })]320  };321322  var message = await client.Messages.Create(parameters);323  Console.WriteLine(message);324  ```325326  ```go Go327  client := anthropic.NewClient()328329  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{330  	Model:     anthropic.ModelClaudeOpus5,331  	MaxTokens: 1024,332  	Messages: []anthropic.MessageParam{333  		anthropic.NewUserMessage(anthropic.NewTextBlock("What's the weather in NYC?")),334  	},335  	Tools: []anthropic.ToolUnionParam{336  		{OfWebSearchTool20250305: &anthropic.WebSearchTool20250305Param{337  			MaxUses: anthropic.Int(5),338  		}},339  	},340  })341  if err != nil {342  	log.Fatal(err)343  }344  fmt.Println(response)345  ```346347  ```java Java348  import com.anthropic.models.messages.WebSearchTool20250305;349350  void main() {351      AnthropicClient client = AnthropicOkHttpClient.fromEnv();352353      MessageCreateParams params = MessageCreateParams.builder()354          .model(Model.CLAUDE_OPUS_5)355          .maxTokens(1024L)356          .addUserMessage("What's the weather in NYC?")357          .addTool(WebSearchTool20250305.builder()358              .maxUses(5L)359              .build())360          .build();361362      Message response = client.messages().create(params);363      IO.println(response);364  }365  ```366367  ```php PHP368  $client = new Client();369370  $message = $client->messages->create(371      maxTokens: 1024,372      messages: [373          ['role' => 'user', 'content' => "What's the weather in NYC?"],374      ],375      model: 'claude-opus-5',376      tools: [377          [378              'type' => 'web_search_20250305',379              'name' => 'web_search',380              'max_uses' => 5,381          ],382      ],383  );384385  echo $message;386  ```387388  ```ruby Ruby389  client = Anthropic::Client.new390391  message = client.messages.create(392    model: "claude-opus-5",393    max_tokens: 1024,394    messages: [395      { role: "user", content: "What's the weather in NYC?" }396    ],397    tools: [{398      type: "web_search_20250305",399      name: "web_search",400      max_uses: 5401    }]402  )403  puts message404  ```405</CodeGroup>406407## Tool definition408409The web search tool supports the following parameters:410411```json JSON412{413  "type": "web_search_20250305",414  "name": "web_search",415416  // Optional: Limit the number of searches per request417  "max_uses": 5,418419  // Optional: Only include results from these domains.420  // Use allowed_domains or blocked_domains, not both.421  "allowed_domains": ["example.com", "trusteddomain.org"],422423  // Optional: Never include results from these domains424  "blocked_domains": ["untrustedsource.com"],425426  // Optional: Localize search results427  "user_location": {428    "type": "approximate",429    "city": "San Francisco",430    "region": "California",431    "country": "US",432    "timezone": "America/Los_Angeles"433  }434}435```436437All web search tool versions accept `allowed_callers`, which controls whether Claude calls web search directly or from code execution through [dynamic filtering](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#dynamic-filtering). On `web_search_20260209` and later it defaults to `["code_execution_20260120"]` instead of `["direct"]`. See [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#zdr-and-allowed-callers) for how to configure it. `web_search_20260318` and later also accept [`response_inclusion`](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#response-inclusion).438439### Max uses440441The `max_uses` parameter limits the number of searches performed. If Claude attempts more searches than allowed, the `web_search_tool_result` is an error with the `max_uses_exceeded` error code.442443Simple factual queries typically use 1–3 searches; comparative or multientity research can use 10 or more. For guidance on choosing a value, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools).444445### Domain filtering446447Provide `allowed_domains` or `blocked_domains`, not both. If a request includes both, the API returns a 400 error. Entries are bare domains with an optional path, for example `example.com` or `example.com/blog`, without a scheme.448449For the full domain filtering rules, see [Domain filtering](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#domain-filtering) in the Server tools guide.450451On [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview), set these fields on the `web_search` entry of the agent toolset; see [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools#restrict-web-search-and-web-fetch-domains).452453### Localization454455The `user_location` parameter allows you to localize search results based on a user's location. Provide at least one of `city`, `region`, `country`, or `timezone`.456457* `type`: The type of location (must be `approximate`)458* `city`: The city name459* `region`: The region or state460* `country`: The two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. The API rejects unsupported country codes with a 400 error.461* `timezone`: The [IANA timezone ID](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).462463On Claude Managed Agents, the `web_search` entry of the agent toolset accepts a `user_location` object with the same fields. The API rejects an unsupported `country` code with a 400 error when you create or update the agent, or when you create or update a session that supplies the setting. See [Restrict web search and web fetch domains](https://platform.claude.com/docs/en/managed-agents/tools#restrict-web-search-and-web-fetch-domains).464465### Response inclusion466467<Note>468  Requires `web_search_20260318` or later.469</Note>470471The `response_inclusion` parameter controls how search result blocks appear in the API response when the result was consumed by a completed [code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) call in the same turn. Set `"response_inclusion": "excluded"` to drop those nested `server_tool_use` and result block pairs entirely from the response, reducing output token costs for agentic workflows that don't need to echo raw search content back to the client. The default is `"full"`. Results from direct calls, or from code execution calls that paused before completing, are always returned in full so they can be sent back on the next turn.472473```json JSON474{475  "tools": [476    {477      "type": "web_search_20260318",478      "name": "web_search",479      "response_inclusion": "excluded"480    }481  ]482}483```484485## Response486487Here's an example response structure:488489```json Output490{491  "role": "assistant",492  "content": [493    // 1. Claude's decision to search494    {495      "type": "text",496      "text": "I'll search for when Claude Shannon was born."497    },498    // 2. The search query used499    {500      "type": "server_tool_use",501      "id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",502      "name": "web_search",503      "input": {504        "query": "claude shannon birth date"505      }506    },507    // 3. Search results508    {509      "type": "web_search_tool_result",510      "tool_use_id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",511      "content": [512        {513          "type": "web_search_result",514          "url": "https://en.wikipedia.org/wiki/Claude_Shannon",515          "title": "Claude Shannon - Wikipedia",516          "encrypted_content": "EqgfCioIARgBIiQ3YTAwMjY1Mi1mZjM5LTQ1NGUtODgxNC1kNjNjNTk1ZWI3Y...",517          "page_age": "April 30, 2025"518        }519      ]520    },521    {522      "text": "Based on the search results, ",523      "type": "text"524    },525    // 4. Claude's response with citations526    {527      "text": "Claude Shannon was born on April 30, 1916, in Petoskey, Michigan",528      "type": "text",529      "citations": [530        {531          "type": "web_search_result_location",532          "url": "https://en.wikipedia.org/wiki/Claude_Shannon",533          "title": "Claude Shannon - Wikipedia",534          "encrypted_index": "Eo8BCioIAhgBIiQyYjQ0OWJmZi1lNm..",535          "cited_text": "Claude Elwood Shannon (April 30, 1916 – February 24, 2001) was an American mathematician, electrical engineer, computer scientist, cryptographer and i..."536        }537      ]538    }539  ],540  "id": "msg_a930390d3a",541  "usage": {542    "input_tokens": 6039,543    "output_tokens": 931,544    "server_tool_use": {545      "web_search_requests": 1546    }547  },548  "stop_reason": "end_turn"549}550```551552This example shows a direct search. When a search runs through [dynamic filtering](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#dynamic-filtering), the response also contains the [code execution tool's](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) result blocks, and each nested `server_tool_use` and `web_search_tool_result` pair carries a `caller` field identifying the code execution call that made it.553554### Search results555556Search results include:557558* `url`: The URL of the source page559* `title`: The title of the source page560* `page_age`: When the site was last updated561* `encrypted_content`: Encrypted content that you must pass back in multi-turn conversations562563To continue a conversation that contains search results, send the assistant's content blocks back exactly as you received them, including each result's `encrypted_content`. The API decrypts that content on later turns to restore the search results in Claude's context. If `encrypted_content` is missing or modified, the request fails with a 400 validation error.564565### Citations566567Citations are always enabled for web search, and each `web_search_result_location` includes:568569* `url`: The URL of the cited source570* `title`: The title of the cited source571* `encrypted_index`: A reference that must be passed back for multi-turn conversations572* `cited_text`: Up to 150 characters of the cited content573574The web search citation fields `cited_text`, `title`, and `url` do not count toward input or output token usage.575576<Note>577  When displaying API outputs directly to end users, citations must be included to the original source. If you are making modifications to API outputs, including by reprocessing or combining them with your own material before displaying them to end users, display citations as appropriate based on consultation with your legal team.578</Note>579580### Errors581582When the web search tool encounters an error (such as hitting rate limits), the Claude API still returns a 200 (success) response. The error is represented within the response body using the following structure:583584```json Output585{586  "type": "web_search_tool_result",587  "tool_use_id": "srvtoolu_a93jad",588  "content": {589    "type": "web_search_tool_result_error",590    "error_code": "max_uses_exceeded"591  }592}593```594595On an error, `content` is a single error object rather than a list of result blocks. A search that succeeds but matches no results returns an empty `content` list, not an error.596597These are the possible error codes:598599* `too_many_requests`: Rate limit exceeded600* `invalid_tool_input`: Invalid search query parameter601* `max_uses_exceeded`: Maximum web search tool uses exceeded602* `query_too_long`: Query exceeds maximum length603* `request_too_large`: The search request is too large, typically because of a long domain filter list604* `unavailable`: An internal error occurred605606### `pause_turn` stop reason607608The API can pause a long-running search turn and return `stop_reason: "pause_turn"`. To continue, send the paused assistant message back unchanged in a new request.609610If Claude calls web search and one of your client tools in the same group of parallel tool calls, the API returns `stop_reason: "tool_use"` instead and does not run the search yet. To continue, return the client tool results, and the API runs the search in the next request. See [Mixing server tools and client tools in one turn](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#mixing-server-tools-and-client-tools-in-one-turn).611612For the server-side loop and `pause_turn` handling, see [The server-side loop and pause\_turn](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#the-server-side-loop-and-pause-turn) in the Server tools guide.613614## Prompt caching615616To cache tool definitions across turns, see [Tool use with prompt caching](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-use-with-prompt-caching).617618## Streaming619620With streaming enabled, you'll receive search events as part of the stream. There will be a pause while the search runs:621622```sse Output623event: message_start624data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}}625626event: content_block_start627data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}628629// Claude's decision to search630631event: content_block_start632data: {"type": "content_block_start", "index": 1, "content_block": {"type": "server_tool_use", "id": "srvtoolu_xyz789", "name": "web_search"}}633634// Search query streamed635event: content_block_delta636data: {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": "{\"query\":\"latest quantum computing breakthroughs 2025\"}"}}637638// Pause while search executes639640// Search results streamed641event: content_block_start642data: {"type": "content_block_start", "index": 2, "content_block": {"type": "web_search_tool_result", "tool_use_id": "srvtoolu_xyz789", "content": [{"type": "web_search_result", "title": "Quantum Computing Breakthroughs in 2025", "url": "https://example.com"}]}}643644// Claude's response with citations (omitted in this example)645```646647## Batch requests648649You can include the web search tool in the [Messages Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing). Web search tool calls through the Messages Batches API are priced the same as those in regular Messages API requests.650651To protect shared capacity, the Batches API throttles web search requests per organization, so large batches with many searches might take longer to complete. You can see your organization's web search rate limit on the [Rate limits](https://platform.claude.com/settings/limits) page in the Claude Console. To request a higher limit, contact sales from that page.652653## Usage and pricing654655Web search usage is charged in addition to token usage:656657```json658{659  "usage": {660    "input_tokens": 105,661    "output_tokens": 6039,662    "cache_read_input_tokens": 7123,663    "cache_creation_input_tokens": 7345,664    "server_tool_use": {665      "web_search_requests": 1666    }667  }668}669```670671Web search is available on the Claude API for **$10 per 1,000 searches**, plus standard token costs for search-generated content. Web search results retrieved throughout a conversation are counted as input tokens, in search iterations executed during a single turn and in subsequent conversation turns.672673Each web search counts as one use, regardless of the number of results returned. If an error occurs during web search, the web search will not be billed.674675## Next steps676677<CardGroup cols={3}>678  <Card title="Web fetch tool" icon="link" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool">679    Fetch and read content from specific URLs to augment Claude's context with live web content.680  </Card>681682  <Card title="Server tools" icon="tool" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools">683    Work with Anthropic-executed tools: server\_tool\_use blocks, pause\_turn continuation, and domain filtering.684  </Card>685686  <Card title="Tool reference" icon="book" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference">687    Directory of Anthropic-provided tools and reference for optional tool definition properties.688  </Card>689</CardGroup>690
Files main
Menu

Theme