> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic Web Search

> Ask a question and get a Claude-written answer grounded in a live web search, with the underlying sources and inline citations, billed at exact cost.

Ask a question and get an answer that Claude wrote after searching the live web. Send a normal Messages request — a `messages` array plus `max_tokens` — and the endpoint injects a fixed, server-pinned model and the `web_search` tool for you; you cannot override the model or add tools, which keeps cost bounded. Claude decides when to search (up to `max_uses` searches, default 5), reads the results, and answers with inline citations. The response is a standard Anthropic Messages object: `content[]` contains `server_tool_use` (the queries issued), `web_search_tool_result` (the sources found) and `text` blocks (the answer with `citations`), and `usage.server_tool_use.web_search_requests` reports how many searches were billed. Billing is pay-as-you-go at exact cost: `web_search_requests × $0.01` plus the model's own token cost, with no markup; a failed search (HTTP 200 `web_search_tool_result_error`) is not billed. Use this when you want a written, cited answer grounded in current web content — for open-web research that returns ranked links and page text in one call use [`post_tavily_search`](/docs/api-reference/search/post_tavily-search) instead, and for the OpenAI-model equivalent see [`post_openai_websearch_search`](/docs/api-reference/search/post_openai-websearch-search).


## OpenAPI

````yaml openapi/websearch.json POST /anthropic-websearch/search
openapi: 3.0.0
info:
  title: Web Search API
  version: 1.0.0
  description: >-
    Model-grounded web search endpoints that run a real web search inside a
    fixed frontier model and return the model's answer together with the
    underlying search results and citations. Billed pay-as-you-go at exact
    provider cost (no markup).
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - bearerAuth: []
paths:
  /anthropic-websearch/search:
    post:
      tags:
        - >-
          https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool
      summary: Model-grounded web search (Anthropic).
      description: >-
        Ask a question and get an answer that Claude wrote after searching the
        live web. Send a normal Messages request — a `messages` array plus
        `max_tokens` — and the endpoint injects a fixed, server-pinned model and
        the `web_search` tool for you; you cannot override the model or add
        tools, which keeps cost bounded. Claude decides when to search (up to
        `max_uses` searches, default 5), reads the results, and answers with
        inline citations. The response is a standard Anthropic Messages object:
        `content[]` contains `server_tool_use` (the queries issued),
        `web_search_tool_result` (the sources found) and `text` blocks (the
        answer with `citations`), and
        `usage.server_tool_use.web_search_requests` reports how many searches
        were billed. Billing is pay-as-you-go at exact cost:
        `web_search_requests × $0.01` plus the model's own token cost, with no
        markup; a failed search (HTTP 200 `web_search_tool_result_error`) is not
        billed. Use this when you want a written, cited answer grounded in
        current web content — for open-web research that returns ranked links
        and page text in one call use
        [`post_tavily_search`](/api-reference/search/post_tavily-search)
        instead, and for the OpenAI-model equivalent see
        [`post_openai_websearch_search`](/api-reference/search/post_openai-websearch-search).
      operationId: post_anthropic_websearch_search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - messages
                - max_tokens
              properties:
                messages:
                  type: array
                  description: >-
                    Conversation messages, same format as the Anthropic Messages
                    API. The user turn holds your question.
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                      content:
                        type: string
                        description: >-
                          Message text. Structured content blocks are also
                          accepted.
                  example:
                    - role: user
                      content: >-
                        What are the three biggest AI announcements this week?
                        Give one sentence each with sources.
                max_tokens:
                  type: integer
                  description: >-
                    Maximum number of tokens to generate in the answer. Required
                    by the upstream Messages API.
                  default: 1024
                  example: 1024
                system:
                  type: string
                  description: Optional system prompt to steer the answer's tone or format.
            example:
              max_tokens: 1024
              messages:
                - role: user
                  content: >-
                    What are the three biggest AI announcements this week? Give
                    one sentence each with sources.
      responses:
        '200':
          description: >-
            A standard Anthropic Messages response. `content[]` interleaves the
            searches performed and the cited answer;
            `usage.server_tool_use.web_search_requests` is the billed search
            count.
          headers:
            X-AISA-Web-Search-Count:
              description: Number of web searches billed for this request.
              schema:
                type: integer
            X-AISA-Price-USD:
              description: Amount charged to your account for this request, in USD.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    example: message
                  role:
                    type: string
                    example: assistant
                  stop_reason:
                    type: string
                    example: end_turn
                  content:
                    type: array
                    description: >-
                      Ordered blocks: server_tool_use (search queries),
                      web_search_tool_result (sources), and text (the cited
                      answer).
                    items:
                      type: object
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                      output_tokens:
                        type: integer
                      cache_read_input_tokens:
                        type: integer
                      cache_creation_input_tokens:
                        type: integer
                      server_tool_use:
                        type: object
                        properties:
                          web_search_requests:
                            type: integer
                            description: Billed web search count.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````