Grok CLI on your own GPUs.
xAI’s Grok Build CLI with LM Warden as a bring-your-own-key model.
- Protocol
- OpenAI Chat Completions
- Support
- Local models only
- Verified
- Run against a live warden on 2026-10-04 with grok 1.0.46 (Grok Build), grok-dev 1.1.7. Grok Build: a one-word reply and a read_file tool call, with no xAI login. grok-dev: chat works; its tool calls fail with AI_TypeValidationError.
Local models only, over Chat Completions (api_backend = chat_completions). There is no pass-through to xAI, and a BYOK model needs no xAI login. session_summary keeps Grok’s session-title requests on this model; without it Grok asks this warden for grok-4.6 and gets a 404. Grok adds its own sections to config.toml when it runs. The community grok-cli (npm grok-dev) is a different tool: chat works, tool calls do not.
Requirements
- Needs a model with tool calling (agentic edits).
- Works best with at least 32,768 tokens of context.
Setup
In the console, Connect writes these files with your warden’s address, your key and the model you picked. Here they are with placeholders.
Grok Build (official)
A model entry in ~/.grok/config.toml; the key comes from LMWARDEN_KEY. Install: curl -fsSL https://x.ai/cli/install.sh | bash, or npm i -g @xai-official/grok
~/.grok/config.toml)[model.lmwarden] model = "your-served-model-name" name = "LM Warden · your-served-model-name" base_url = "https://your-warden/v1" env_key = "LMWARDEN_KEY" api_backend = "chat_completions" context_window = 32768 [models] default = "lmwarden" session_summary = "lmwarden" # The model's context window is unknown: 32768 is a guess. Set it to the model's real window.
export LMWARDEN_KEY=vw_YOUR_KEY grok -m lmwarden
Community grok-cli
The community grok-cli reads its base URL, key and model from the env and needs Bun installed. Chat works; tool calls fail, because its xAI SDK rejects tool-call chunks that arrive in parts, as vLLM streams them.
export GROK_BASE_URL=https://your-warden/v1 export GROK_API_KEY=vw_YOUR_KEY export GROK_MODEL=your-served-model-name npx -y grok-dev
Official documentation: https://docs.x.ai/build/settings/reference (read 2026-10-04).