Overview
Grok Build is xAI’s official CLI assistant. It supports custom OpenAI-compatible endpoints via~/.grok/config.toml, so any model in the AI Gateway catalog can be reached from a single config entry without changing tooling.
Prerequisites
- Active Orq.ai account
- Orq.ai API key
Install Grok Build
- macOS / Linux
- Windows
grok and agent in ~/.grok/bin/ and updates the user PATH.
Setup
Edit ~/.grok/config.toml
Configure models with a Replace
[models] section and one [model.<key>] block per model. The example below uses Claude Sonnet 4.6 routed through Orq.ai:anthropic/claude-sonnet-4-6 with any model identifier from the AI Gateway catalog. To register additional models, add more [model.<key>] blocks and switch between them with -m <key>.Export the API key
<orq-api-key> with the key from Organization > API Keys. The env_key field in config.toml tells Grok Build which environment variable to read.Configuration Reference
config.toml fields
| Field | Description |
|---|---|
[models].default | Key of the model block to use when -m is not passed |
model | AI Gateway model identifier (e.g. anthropic/claude-sonnet-4-6, openai/gpt-4o) |
base_url | Set to https://api.orq.ai/v3/router for all AI Gateway models |
env_key | Name of the environment variable that holds the API key |
name | Display name shown in the Grok Build UI |
context_window | Context window size in tokens |
max_completion_tokens | Maximum tokens in the completion |
Adding more catalog models
Add one[model.<key>] block per model and use -m <key> to select at runtime:
Troubleshooting
Bare `grok` resolves to a different CLI
Bare `grok` resolves to a different CLI
If the npm package
@vibe-kit/grok-cli is installed, the bare grok command may resolve to it instead of the xAI binary. Use the absolute path ~/.grok/bin/grok or remove the npm package to restore the correct resolution.Requests failing with 401 Unauthorized
Requests failing with 401 Unauthorized
No trace appearing in Orq.ai
No trace appearing in Orq.ai
Confirm
base_url is set to https://api.orq.ai/v3/router and env_key points to a valid Orq.ai API key (not an xAI or OpenAI key). Requests to the wrong endpoint will not appear in Orq.ai traces.Model not found error
Model not found error
Verify the
model field uses the exact AI Gateway identifier (e.g. anthropic/claude-sonnet-4-6). Check the available models in Workspace Settings → Models.