# Grok X search with cited posts

Grok searches X (Twitter) posts server-side, filters by accounts and dates, understands images and videos on request, and answers with citations. Needs query.

Grok (xAI) searches X (Twitter) posts server-side, filters by accounts and dates, understands images and videos on request, and answers with citations of the posts. Price: $0.005 per X post and $0.01 per profile Grok fetches, plus model tokens (grok-4.3 $1.25 in / $2.50 out per million, grok-4.6 and grok-4.7 $2 / $6). Billed at the exact cost xAI reports for the call; the quote is the reserved maximum.

- Tool ID: `xai/x-search`
- Name in the catalog: Grok X search: what X (Twitter) says, with cited posts
- Provider: [xAI](/providers/xai.md)
- Capability: [X posts](/tools/x/posts.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.7
      }
    }
  ],
  "headroom": 1
}
```

Pricing source: [https://docs.x.ai/developers/pricing](https://docs.x.ai/developers/pricing). X Search $5 per 1k posts and $10 per 1k profiles fetched (per item since 2026-09-21); 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-09-07.

## 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_x_handles": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 20,
      "description": "Only posts from these accounts (without @). Exclusive with excluded_x_handles. Name the account in the query too, or Grok may skip the search."
    },
    "excluded_x_handles": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 20,
      "description": "Never posts from these accounts (without @)."
    },
    "from_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Earliest post date, YYYY-MM-DD."
    },
    "to_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Latest post date, YYYY-MM-DD."
    },
    "enable_image_understanding": {
      "type": "boolean",
      "default": false,
      "description": "Let Grok look at images in posts (more tokens)."
    },
    "enable_video_understanding": {
      "type": "boolean",
      "default": false,
      "description": "Let Grok watch videos in posts (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/x-search",
  "input": {
    "query": "In one sentence, what did the xai account post most recently? Cite the post.",
    "allowed_x_handles": [
      "xai"
    ],
    "max_output_tokens": 300,
    "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/x-search)

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

---

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