Getting Started
Grok Build
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
curl -fsSL https://x.ai/cli/install.sh | bashStart an interactive session
cd your-project
grokOn first launch, Grok opens a browser for authentication. In non-browser environments, use an API key:
export XAI_API_KEY="xai-..."
grokUseful first prompts:
Explain this repo.
@src/main.rs Walk me through this file.Run headlessly
grok -p "Explain this codebase"
grok -p "Explain the architecture" --output-format streaming-jsonHeadless usage is ideal for scripts, automations, or integration into other apps.
Custom models
Grok supports any custom model. Add it to your user-level config file, ~/.grok/config.toml (on Windows, %USERPROFILE%\.grok\config.toml):
[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 ~/.grok/config.toml, 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:
grok inspect
grok -p "Hello" -m my-modelYou can also switch inside the TUI with /model <name>.
Use Grok 4.7 on the API
grok-4.7, SpaceXAI's latest model, is available directly on the xAI API. Drop it into your own agent loop, IDE integration, or coding tool.
curl https://api.x.ai/v1/responses \
-H "Authorization: Bearer $XAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.7",
"input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"
}'Features
Status Line. Live session context in a row at the bottom of the TUI.
Next
Grok Bot — AI teammates on a cloud computer
Last updated:July 6, 2026