Grok CLI Manual
Configuration
Most Grok configuration problems come from the file path, TOML nesting, or the model definition that is actually active.
Configuration paths
| Environment | Configuration file |
|---|---|
| Linux / macOS | ~/.grok/config.toml |
| Native Windows | %USERPROFILE%\.grok\config.toml |
| WSL2 | ~/.grok/config.toml inside WSL |
Show the configuration Grok actually reads:
grok inspectMain sections
| Section | Purpose |
|---|---|
[models] | Select the default model |
[endpoints] | Set separate base addresses for model requests and Imagine image/video tools |
[model."<id>"] | Define model ID, key, backend, and context window |
[auth] | Select OAuth or API Key authentication |
[session] | Control session behavior and automatic compaction |
[ui] | Control the interface, tool approval, and compact mode |
Model and Imagine endpoints are separate
[endpoints]
models_base_url = "https://api.example.com"
xai_api_base_url = "https://api.example.com"
[auth]
preferred_method = "api_key"models_base_url handles model discovery and primary inference requests. image_gen, image_edit, image_to_video, and reference_to_video read xai_api_base_url separately. Set both fields to the same main API origin without /v1; direct API calls still use the standard /v1/... paths. If a Grok OAuth session already exists, preferred_method = "api_key" prevents it from replacing the Router Key. See Image Generation and Editing and Video Generation for complete examples.
Common session and UI settings
[session]
# The official default is 85; 80 compacts earlier
auto_compact_threshold_percent = 80
[ui]
max_thoughts_width = 120
yolo = true
compact_mode = false
permission_mode = "always-approve"yolo and always-approve reduce tool-confirmation prompts. Use them only with trusted projects in a local environment that you can roll back.
See the Grok CLI settings reference for all available fields.