docs/src/content/docs/en/configuration/agents/grok.md
Grok CLI is xAI's coding agent. In CCR it is CLI only and always uses Only opened from CCR: CCR does not rewrite your global Grok config. Instead it generates a launch wrapper and an isolated Grok home for each profile, so inference always uses the CCR key and model gateway.
Use this page to route Grok CLI to any CCR provider or Fusion model, or to run several isolated Grok CLI sessions.
New to CCR? Add a provider and model first. See Add a provider and the Agent Config overview.
grok on PATH).When you save a Grok CLI profile, CCR generates a launch wrapper in its bin directory that exports:
GROK_MODELS_BASE_URL → the CCR gateway /v1 endpoint; GROK_MODELS_LIST_URL → the /v1/models endpoint (model list).XAI_API_KEY → this profile's CCR API key.GROK_DEFAULT_MODEL → your selected model.GROK_HOME → a profile-specific directory.It also points GROK_HOME at a profile-specific home. That home starts as a private copy of your source Grok home's config.toml, while auth.json is excluded so a local xAI OAuth token cannot override the CCR key. Plugins, skills, sessions, and other home entries stay linked to the original Grok home.
If the CCR Desktop gateway is not running when you launch, ccr-app starts a shared temporary gateway service and stops it after the last concurrent Grok session exits.
Grok - Work).Grok CLI is fixed to Only opened from CCR and CLI only, so those two fields are not editable. The fields you configure are:
| Field | How to set it | Effect |
|---|---|---|
| Agent | Choose Grok CLI | Tells CCR to generate the Grok wrapper and isolated home. |
| Config name | Free text, e.g. Grok - Work | Identifies the profile and is used in ccr-app "<name>". |
| Enabled | Toggle on/off | Disabled profiles are not applied and not offered as launch entries. |
| Model | A provider model or Fusion model | Writes GROK_DEFAULT_MODEL, the model Grok CLI uses at startup. |
| Environment variables | Key/value rows | Exported into the wrapper. See below. |
CCR_GROK_BIN — absolute path to the real grok executable, if it is not on PATH in the CCR Desktop process.GROK_HOME / GROK_STORAGE_DIR / GROK_CONFIG_DIR — set the source Grok home CCR copies config.toml from (defaults to ~/.grok). Use this only when your Grok home lives somewhere non-standard.NO_PROXY/no_proxy automatically so Grok talks to the local gateway directly; you do not configure this.Variables CCR manages itself (
GROK_MODELS_BASE_URL,GROK_MODELS_LIST_URL,GROK_DEFAULT_MODEL,GROK_HOME,XAI_API_KEY, etc.) are reserved — setting them manually in the profile env has no effect because the wrapper overwrites them.
Click the terminal button on the profile card and run the copied command:
ccr-app "Grok - Work"
Inside Grok CLI, use /model to switch among the provider and Fusion models CCR returns; switched requests still go through CCR.
Each profile has its own id and its own isolated GROK_HOME, so multiple Grok CLI profiles can run at once with different models or separate session histories, all without touching your original ~/.grok.
ccr-app command copied from the profile card./model and confirm the CCR-exposed models appear.auth.json by design; confirm you launched via ccr-app and not a directly-opened grok.grok not found: set CCR_GROK_BIN to the real executable path./model shows no CCR models: confirm a provider + model is configured in CCR, and that the gateway is reachable (the temp gateway starts only while a managed session is running).~/.grok, set GROK_HOME (or GROK_STORAGE_DIR / GROK_CONFIG_DIR) to the correct source home.