Getting Started
Grok Build is a powerful and extensible coding agent. Use it via an interactive TUI, headlessly in scripts or bots, or through the Agent Client Protocol (ACP) in other apps.
The TUI provides a rich, mouse-interactive, fullscreen experience for coding with agents.
Install
Bash
curl -fsSL https://x.ai/cli/install.sh | bash
Start an interactive session
Bash
cd your-project
grok
On first launch, Grok opens a browser for authentication. In non-browser environments, use an API key:
Bash
export GROK_CODE_XAI_API_KEY="xai-..."
grok
Useful first prompts:
Text
Explain this repo.
@src/main.rs Walk me through this file.
Run headlessly
Bash
grok -p "Explain this codebase"
grok -p "Explain the architecture" --output-format streaming-json
Headless usage is ideal for scripts, automatinos, or integration into other apps.
Custom models
Grok supports any custom model:
Text
[model.my-model]
model = "model-id"
base_url = "https://api.example.com/v1"
name = "Display Name"
env_key = "API_KEY"
[models]
default = "my-model"
After updating config, use grok inspect to see what Grok discovered in the current directory, including config sources, instructions, skills, plugins, hooks, and MCP servers, then pick the model in headless mode or in the TUI:
Bash
grok inspect
grok -p "Hello" -m my-model
You can also switch inside the TUI with /model <name>.
Next
Last updated: April 12, 2026