> ## Documentation Index
> Fetch the complete documentation index at: https://agdiai-597e782f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok Search

# Grok Search

Agdi supports Grok as a `web_search` provider, using xAI web-grounded
responses to produce AI-synthesized answers backed by live search results
with citations.

## Get an API key

**1. Create a key**

Get an API key from [xAI](https://console.x.ai/).

**2. Store the key**

Set `XAI_API_KEY` in the Gateway environment, or configure via:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
agdi configure --section web
```

## Config

```json5 theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  plugins: {
    entries: {
      xai: {
        config: {
          webSearch: {
            apiKey: "xai-...", // optional if XAI_API_KEY is set
          },
        },
      },
    },
  },
  tools: {
    web: {
      search: {
        provider: "grok",
      },
    },
  },
}
```

**Environment alternative:** set `XAI_API_KEY` in the Gateway environment.
For a gateway install, put it in `~/.agdi/.env`.

## How it works

Grok uses xAI web-grounded responses to synthesize answers with inline
citations, similar to Gemini's Google Search grounding approach.

## Supported parameters

Grok search supports the standard `query` and `count` parameters.
Provider-specific filters are not currently supported.

## Related

* [Web Search overview](https://agdiai-597e782f.mintlify.site/tools/web.md) -- all providers and auto-detection
* [Gemini Search](https://agdiai-597e782f.mintlify.site/tools/gemini-search.md) -- AI-synthesized answers via Google grounding


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.