# Grok web search with cited sources

Grok searches and reads the web server-side, restricted to or excluding chosen domains, understands images on request, and answers with citations. Needs query.

Grok (xAI) searches and reads the web server-side, restricted to or excluding chosen domains, understands images on request, and answers with citations. Price: $0.005 per web search or page Grok opens, plus model tokens (grok-4.3 $1.25 in / $2.50 out per million, grok-4.6 and grok-4.7 $2 / $6). max_turns (one search per turn) and max_output_tokens are sent to xAI; the quote reserves the worst case of those limits plus 200k input tokens per step. You are billed the actual cost xAI reports for the call, never more than the reservation.

- Tool ID: `xai/web-search`
- Name in the catalog: Grok web search: browse the web and answer with cited sources
- Provider: [xAI](/providers/xai.md)
- Capability: [Web search for agents](/tools/web-search/web-search.md)
- Price: usage based, the maximum is shown before a run
- Authentication: an authorised Agentik workspace is required for execution, including zero-price tools.

## Pricing contract

Billed at the cost the provider reports for the call, never above $5. Your agent sees the maximum before running.


```json
{
  "model": "reported",
  "costPath": "",
  "costTerms": [
    {
      "path": "usage.cost_in_usd_ticks",
      "usd": 1e-10
    }
  ],
  "requireCost": true,
  "maxUsdDefault": 0.25,
  "maxUsdCap": 5,
  "multipliers": [
    {
      "when": {
        "field": "model",
        "in": [
          "grok-4.6",
          "grok-4.7"
        ]
      },
      "setUsd": 0.4
    },
    {
      "addUsdPer": {
        "field": "max_turns",
        "default": 2,
        "max": 4,
        "usd": 0.25
      }
    },
    {
      "when": {
        "field": "model",
        "in": [
          "grok-4.6",
          "grok-4.7"
        ]
      },
      "addUsdPer": {
        "field": "max_turns",
        "default": 2,
        "max": 4,
        "usd": 0.15
      }
    },
    {
      "addUsdPer": {
        "field": "max_output_tokens",
        "default": 1024,
        "max": 8192,
        "usd": 0.000005
      }
    },
    {
      "when": {
        "field": "model",
        "in": [
          "grok-4.6",
          "grok-4.7"
        ]
      },
      "addUsdPer": {
        "field": "max_output_tokens",
        "default": 1024,
        "max": 8192,
        "usd": 0.000007
      }
    },
    {
      "addUsdPer": {
        "field": "max_turns",
        "default": 2,
        "max": 4,
        "usd": 0.005
      }
    }
  ],
  "headroom": 1
}
```

Pricing source: [https://docs.x.ai/developers/pricing](https://docs.x.ai/developers/pricing). Web Search $5 per 1k calls; grok-4.3 $1.25 / $2.50 per 1M tokens ($2.50 / $5 once the prompt reaches 200k); grok-4.6 and grok-4.7 $2 / $6 ($4 / $12 from 200k); global endpoint..

Price verification date: 2026-10-08.

## Complete input schema


```json
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4000,
      "description": "The question or task for Grok. Ask for citations to get post or page links."
    },
    "instructions": {
      "type": "string",
      "maxLength": 4000,
      "description": "System instructions: tone, format, language, what to focus on."
    },
    "model": {
      "type": "string",
      "enum": [
        "grok-4.3",
        "grok-4.7",
        "grok-4.6"
      ],
      "default": "grok-4.3",
      "description": "grok-4.3 is the cheapest (1M context); grok-4.7 is xAI's most capable model; grok-4.6 costs the same as grok-4.7."
    },
    "max_output_tokens": {
      "type": "integer",
      "minimum": 64,
      "maximum": 8192,
      "default": 1024,
      "description": "Cap on answer plus reasoning tokens, sent to xAI."
    },
    "max_turns": {
      "type": "integer",
      "minimum": 1,
      "maximum": 4,
      "default": 2,
      "description": "Cap on agentic search turns, sent to xAI (one search per turn)."
    },
    "allowed_domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "description": "Only these domains (max 5). Exclusive with excluded_domains."
    },
    "excluded_domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "description": "Never these domains (max 5)."
    },
    "enable_image_understanding": {
      "type": "boolean",
      "default": false,
      "description": "Let Grok look at images on pages (more tokens)."
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}
```

## Published example

This is the provider tool’s published example. Replace example values with the user’s requested inputs, respecting the schema; do not execute an example merely to test a connection.


```json
{
  "tool_id": "xai/web-search",
  "input": {
    "query": "In one sentence, what is the Model Context Protocol? Cite one source.",
    "max_output_tokens": 200,
    "max_turns": 1
  }
}
```

## Execute and retrieve

Inspect again before execution, explain the price and obtain the required authority. Use MCP run_tool or POST /v1/run with this tool ID, valid input and an idempotency key. Save the returned run ID and follow the actual state. If Agentik answers that the tool is temporarily unavailable, do not retry it blindly; use discovery to propose an alternative.

A partial or uncertain result can still have consumed provider resources. Consult [billing](/docs/billing.md), [idempotency](/docs/idempotency.md) and [asynchronous results](/docs/async.md).

[Provider documentation](https://docs.x.ai/developers/tools/web-search)

[REST inspection](https://api.agentik.cc/v1/tools/xai/web-search) · [OpenAPI](/openapi.json) · [Connection guide](/connect.md)

---

[HTML page](/providers/xai/web-search) · [Agent index](/llms.txt)
