# Grok Build

Official local grok CLI, @xai-official/grok; not Grok web/cloud.

Source: https://zrelay.net/docs/agents/coding-agents/grok-build/

## Manual setup

1. Check grok --version. The reviewed npm release is 1.0.77 (2026-11-05); the website changelog lagged. If missing, the official install route is curl -fsSL https://x.ai/cli/install.sh | bash on macOS/Linux/WSL, or npm install -g @xai-official/grok with Node 20+. Installation requires a deliberate choice.

2. Enter ZRELAY_API_KEY locally with hidden input. Merge the TOML below into $GROK_HOME/config.toml, normally ~/.grok/config.toml (Windows: %USERPROFILE%\.grok\config.toml). Preserve login, models, permissions and default selection.

3. Check TOML and run grok inspect locally without publishing its complete output. Launch grok -m zrelay-grok --disable-web-search --no-subagents from the same environment. Use a Grok Flex/Prime key for grok-4.7 Chat Completions.

4. Model definitions belong to user scope; project .grok/config.toml has restrictions. Do not use GROK_MODELS_BASE_URL: its discovery requires XAI_API_KEY. Search has a separate model and is initially disabled with subagents to avoid unverified auxiliary routes.

## Configuration and commands

```
read -rs -p 'Zrelay key: ' ZRELAY_API_KEY
export ZRELAY_API_KEY
```

```
$env:ZRELAY_API_KEY = [System.Net.NetworkCredential]::new('', (Read-Host 'Zrelay key' -AsSecureString)).Password
```

```
[model.zrelay-grok]
model = "grok-4.7"
name = "Zrelay Grok"
base_url = "https://api.zrelay.net/v1"
env_key = "ZRELAY_API_KEY"
api_backend = "chat_completions"
context_window = 128000
max_completion_tokens = 4096
supports_backend_search = false
```

## Alternative: ask an AI assistant

Copy this complete prompt into your coding assistant. It describes configuration work; installation and paid tests need your authorization.

```
Configure the official Grok Build CLI for Zrelay. Detect OS, shell, installed version and GROK_HOME. Read https://docs.x.ai/build/settings/reference and https://docs.x.ai/build/cli/reference; check https://keys.zrelay.net/api/catalog and my chosen pool/provider scope. Ask before installing or upgrading anything. Preserve existing settings, login, default model, permissions and secrets. Merge only [model.zrelay-grok] into the user config: model="grok-4.7", name="Zrelay Grok", base_url="https://api.zrelay.net/v1", env_key="ZRELAY_API_KEY", api_backend="chat_completions", context_window=128000, max_completion_tokens=4096, supports_backend_search=false, adjusting only if current documented catalog requires it. Have me enter the key locally with hidden input; never read, print, log or include it in chat. Check TOML and grok inspect without paid calls; redact sensitive output. Provide grok -m zrelay-grok --disable-web-search --no-subagents. Ask explicitly before any paid inference; report configuration validation separately from streaming/tool-loop validation.
```

## Limits and verification

Use base_url and [model.id], not names borrowed from other tools. The conservative context budget is 128000 and enforced output maximum 4096. Version/configuration checks do not establish paid inference, streaming or tool-loop compatibility.

These recipes were reviewed against documentation and public catalog data. No client installation, authenticated request, paid inference, streaming or tool loop was executed. Validate configuration first; a later short text test does not establish complete agent compatibility.

Recheck the [live catalog](https://keys.zrelay.net/api/catalog) and your key’s provider/pool. The reviewed examples have 128000 input and 4096 output maxima unless a client limitation above prevents controlling the request. Never print, log or commit credentials.

## Official sources

Documentation checked 2026-11-09; mutable sources can differ from your installed version.

[https://x.ai/cli/install.sh](https://x.ai/cli/install.sh)

[https://docs.x.ai/build/settings/reference](https://docs.x.ai/build/settings/reference)

[https://docs.x.ai/build/cli/reference](https://docs.x.ai/build/cli/reference)

[https://keys.zrelay.net/api/catalog](https://keys.zrelay.net/api/catalog)

[https://docs.x.ai/build/overview](https://docs.x.ai/build/overview)

[https://docs.x.ai/build/settings](https://docs.x.ai/build/settings)

[https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/11-custom-models.md](https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/11-custom-models.md)

[https://registry.npmjs.org/@xai-official/grok/latest](https://registry.npmjs.org/@xai-official/grok/latest)

[https://x.ai/changelog/build](https://x.ai/changelog/build)
