docs/tools/grok-search.md
OpenClaw supports Grok as a web_search provider, using xAI web-grounded
responses to produce AI-synthesized answers backed by live search results
with citations.
Grok web search prefers an existing xAI OAuth sign-in when one is available.
If no OAuth profile exists, the same xAI API key also powers the built-in
x_search tool for X (formerly Twitter) post search and the code_execution
tool. Storing the key at plugins.entries.xai.config.webSearch.apiKey also
lets OpenClaw reuse it as a fallback for the bundled xAI model provider.
For post-level X metrics (reposts, replies, bookmarks, views), use
x_search with the exact post URL or status ID
instead of a broad search query.
Choosing Grok during openclaw onboard or openclaw configure --section web lets OpenClaw reuse an existing xAI OAuth profile without prompting for
a separate web-search key. Without OAuth, it falls back to xAI API-key setup.
OpenClaw then offers a follow-up step to enable x_search with the same xAI
credential. That follow-up:
web_searchx_search model in the same flowSkip it to enable or change x_search later in config.
```bash
openclaw onboard --auth-choice xai-oauth
openclaw config set tools.web.search.provider grok
```
```bash
openclaw configure --section web
```
{
plugins: {
entries: {
xai: {
config: {
webSearch: {
apiKey: "xai-...", // optional if xAI OAuth or XAI_API_KEY is available
baseUrl: "https://api.x.ai/v1", // optional Responses API proxy/base URL override
},
},
},
},
},
tools: {
web: {
search: {
provider: "grok",
},
},
},
}
Credential alternatives: openclaw models auth login --provider xai --method oauth, XAI_API_KEY in the Gateway environment, or
plugins.entries.xai.config.webSearch.apiKey. For a gateway install, put env
vars in ~/.openclaw/.env.
Grok uses xAI web-grounded responses to synthesize answers with inline citations, similar to Gemini's Google Search grounding approach.
Grok search supports query. count is accepted for shared web_search
compatibility, but Grok always returns one synthesized answer with citations
rather than an N-result list. Provider-specific filters are not supported.
Grok defaults to a 60 second timeout because xAI Responses web-grounded
searches can run longer than the shared web_search default. Override it
with tools.web.search.timeoutSeconds.
Set plugins.entries.xai.config.webSearch.baseUrl to route Grok web search
through an operator proxy or xAI-compatible Responses endpoint. OpenClaw
posts to <baseUrl>/responses after trimming trailing slashes. x_search
falls back to the same webSearch.baseUrl unless
plugins.entries.xai.config.xSearch.baseUrl is set.