Unofficial guide · Grok / xAI API

Moving from Grok Live Search to the web_search and x_search tools

By Ben (BenX) · Published · Last checked against official sources

Grok is xAI's model family, and on the xAI API, search now runs through server-side tools: web_search for web pages and x_search for posts on X. xAI's docs now point Live Search users to the web_search and x_search tools, and the old Live Search guide URL redirects to the Web Search tool page. If your code still sends search_parameters, move it to the tools.

Independent guide. aiedu.guide is not affiliated with xAI (SpaceXAI), Grok, X, OpenRouter or any other company named here, and is not endorsed or sponsored by any of them. Product names belong to their owners, and the official pages we checked are listed at the end.

No affiliate links on this page. See our disclosure.

Everything here comes from xAI's documentation, checked on 8 Oct 2026. We haven't made test calls. For the rest of the series, see the Grok developer guide.

What replaced Live Search in the Grok API?

Short answer: xAI's docs now point Live Search users to the web_search and x_search tools. The old Live Search guide URL redirects to the Web Search tool page, so build new search features on the tools rather than on search_parameters.

What xAI's docs show on 8 Oct 2026:

WhereWhat it shows
Old Live Search guide (https://docs.x.ai/docs/guides/live-search)Redirects (HTTP 308) to the Web Search tool page, /developers/tools/web-search
API referencesearch_parameters still appears in both the Chat Completions and Responses schemas, with no deprecation flag. The Responses schema says it "Takes precedence over web_search_preview tool if specified".
Release notesStill carry "May 2025: Live Search is available on API", with no deprecation entry

xAI's docs don't say what happens today to a request that still sends search_parameters. The guide that used to document it now sends readers to the tools, and that's where xAI documents filters, limits and prices.

Is Grok Live Search deprecated? xAI's docs now point Live Search users to the web_search and x_search tools: the old Live Search guide URL redirects to the Web Search tool page. The API reference still lists search_parameters, but new code should use the tools.

How do I migrate from search_parameters to the search tools?

Short answer: Remove search_parameters from the request body and add web_search, x_search or both to the tools array. Then set each tool's own filters, such as allowed domains or a date range.

Before: a request that relies on Live Search, as older tutorials show it.

{
  "model": "grok-4.7",
  "input": "What are developers saying about Grok 4.7 since launch?",
  "search_parameters": { /* your old Live Search options */ }
}

After: the same question with the search tools, on the Responses API.

curl https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
  "model": "grok-4.7",
  "input": [
    {"role": "user", "content": "What are developers saying about Grok 4.7 since launch?"}
  ],
  "tools": [
    {"type": "web_search"},
    {
      "type": "x_search",
      "from_date": "2026-09-21",
      "to_date": "2026-09-25"
    }
  ]
}'

After, in Python with the OpenAI SDK:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("XAI_API_KEY"),
    base_url="https://api.x.ai/v1",
)

response = client.responses.create(
    model="grok-4.7",
    input="What are developers saying about Grok 4.7 since launch?",
    tools=[
        {"type": "web_search"},
        {"type": "x_search", "from_date": "2026-09-21", "to_date": "2026-09-25"},
    ],
)

print(response.output_text)

Migration checklist:

  1. Remove search_parameters from every request.
  2. Pick the tools: web_search for web pages, x_search for posts on X, or both.
  3. Set filters on each tool: domains on web_search; handles and dates on x_search (details below).
  4. Update cost tracking. Search is now billed per tool call or per item fetched (see the prices below).
  5. Keep encrypted outputs. On the Responses API, grok-4.7 returns encrypted outputs of server-side tools along with its encrypted reasoning; pass them back unchanged if you manage history yourself.

How do I replace search_parameters in Grok API code? Remove search_parameters from the request body and add web_search, x_search or both to the tools array. Then set each tool's own filters, such as allowed domains or a date range.

How do I limit Grok web search to certain sites?

Short answer: Give web_search an allowed_domains list to search only those sites, or an excluded_domains list to skip them. Each list takes up to 5 domains, and you can't use both in the same request.

  • allowed_domains: search and browse only within these domains (max 5).
  • excluded_domains: leave these domains out (max 5).
  • Not both: xAI says "allowed_domains cannot be set together with excluded_domains".
  • Image search is part of Web Search and billed at the Web Search rate.

xAI's docs and its API reference disagree on where the domain lists sit in a Responses request. xAI's Web Search page nests them inside a filters object on the web_search tool. xAI's API reference puts allowed_domains and excluded_domains at the tool's top level, and describes filters as "Only included for compatibility." We don't pick between the two, so check both before you ship a domain filter.

How many domains can I allow in Grok web search? Up to 5 in allowed_domains, or up to 5 in excluded_domains. You can't set both in the same request.

How do I search X posts from specific accounts or dates?

Short answer: Give x_search an allowed_x_handles or excluded_x_handles list (up to 20 handles, not both), and a from_date and to_date as YYYY-MM-DD dates. Both dates are inclusive.

{
  "type": "x_search",
  "allowed_x_handles": ["example_account"],
  "from_date": "2026-09-21",
  "to_date": "2026-09-25"
}
  • allowed_x_handles: only posts from these handles (max 20).
  • excluded_x_handles: skip posts from these handles (max 20). Like the domain lists, you can't set both.
  • from_date and to_date: YYYY-MM-DD dates such as 2026-09-21. xAI says dates in any other format, including full date-times, "aren't applied." The range includes both end dates.

Are Grok X search dates inclusive? Yes. from_date and to_date take YYYY-MM-DD dates, and xAI's docs say the range includes both dates.

What do Grok's web search and X search tools cost?

Short answer: web_search costs $5 per 1,000 calls. x_search is billed per item fetched: $5 per 1,000 posts and $10 per 1,000 user profiles, and fetched parent and quoted posts count too.

Table: search tool prices on the xAI API (last checked 8 Oct 2026)

ToolBilled byPrice
web_search (includes image search)Call$5 per 1,000 calls
x_search, postsPost fetched, including parent and quoted posts$5 per 1,000 posts
x_search, profilesUser profile fetched$10 per 1,000 profiles

Because X search is billed per item, one call that pulls in a long thread can cost more than several small calls. For token prices, see Grok API models, pricing and rate limits.

Through OpenRouter, web search on x-ai/grok-4.7 is listed at $0.005 per call, the same $5 per 1,000. Other channel differences are on the Grok 4.7 channels page.

How is Grok X search billed? Per item fetched, not per call: $5 per 1,000 posts and $10 per 1,000 user profiles. Parent and quoted posts that come back count as fetched posts.

Do the search tools follow the US regional endpoint's guarantee?

Short answer: No. xAI offers a US regional endpoint, https://us.api.x.ai/v1, but xAI says its US guarantee doesn't cover server-side tools, Files or Collections.

If you need data to stay in the US, keep that in mind before you add web_search or x_search to requests on that endpoint. The endpoint's pricing and model list are in the Grok API quickstart.

What other server-side tools does Grok have?

Short answer: Besides the two search tools, xAI runs code execution ($5 per 1,000 calls) and connects to remote MCP servers (tokens only). Your own functions go through function calling.

See Grok function calling and structured outputs for code execution, remote MCP limits and the function-calling quirks.

FAQ

Is Grok Live Search deprecated?

xAI's docs now point Live Search users to the web_search and x_search tools: the old Live Search guide URL redirects to the Web Search tool page. The API reference still lists search_parameters, but new code should use the tools.

How do I replace search_parameters in Grok API code?

Remove search_parameters from the request body and add web_search, x_search or both to the tools array. Then set each tool's own filters, such as allowed domains or a date range.

How many domains can I allow in Grok web search?

Up to 5 in allowed_domains, or up to 5 in excluded_domains. You can't set both in the same request.

Are Grok X search dates inclusive?

Yes. from_date and to_date take YYYY-MM-DD dates, and xAI's docs say the range includes both dates.

How is Grok X search billed?

Per item fetched, not per call: $5 per 1,000 posts and $10 per 1,000 user profiles. Parent and quoted posts that come back count as fetched posts.

Next steps

Official sources

Facts on this page come from these pages. Tool prices and API schemas change often, so check the official page before you rely on a detail.

Checked 8 October 2026