Grok Build
Use aicentos in Grok Build — define a custom model provider through config.toml
Last updated:
Grok Build is xAI's terminal coding agent. It calls the official xAI endpoint by default, but it supports declaring arbitrary OpenAI-compatible [model.*] endpoints in ~/.grok/config.toml. Point the endpoint at aicentos and the same key can call the grok family as well as models from other vendors.
Prerequisites
-
Install Grok Build (official script):
curl -fsSL https://x.ai/cli/install.sh | bash -
Create a dedicated key in the aicentos console (naming it
grok-buildis a good idea).
Configuration to fill in
| Field | Value |
|---|---|
| base_url | https://aicentos.com/v1 |
| api_backend | chat_completions (default) |
| env_key | AICENTOS_API_KEY |
| model | A model ID from the Model Gallery in the console, e.g. grok-4.7, claude-opus-4-8 |
| context_window | Match the chosen model, e.g. 200000 |
Setup steps
-
Write the key into your shell environment (add it to
~/.zshrcor~/.bashrc, thensourcethe file to apply it):export AICENTOS_API_KEY="your_api_key_here" -
Edit
~/.grok/config.tomland add a custom model:[models] default = "aicentos-grok" [model.aicentos-grok] base_url = "https://aicentos.com/v1" env_key = "AICENTOS_API_KEY" api_backend = "chat_completions" context_window = 200000 max_completion_tokens = 8192 description = "aicentos gateway - grok-4.7"The
<name>in[model.<name>]is the model ID. To add more models, for examplegrok-4.7andclaude-opus-4-8, write a separate[model.grok-4.7]and[model.claude-opus-4-8]block for each. -
Start Grok Build and switch with the model picker or a command:
grok /model aicentos-grok
Test
First list the models to see whether yours is recognized:
grok modelsThen send a lightweight prompt (e.g. grok -p "Introduce the current directory in one sentence" -m aicentos-grok) and confirm it returns normally.
Notes
- Grok Build has no
--base-urlcommand-line flag; a custom endpoint can only be specified through the configuration file or environment variables. api_backenddefaults tochat_completions; if you explicitly writeresponsesormessages, make sure the gateway supports the corresponding endpoint, otherwise requests fail.- Credentials are resolved in this order: the
api_keyin the model configuration → the environment variable named byenv_key→ the logged-in session token → the globalXAI_API_KEY. Usingenv_keywith your own variable name keeps things separate from the official xAI account. - If a newly added model omits
context_window, Grok Build assumes 200,000 by default; setting it explicitly for the chosen model is recommended. - Once a custom endpoint is configured, the xAI subscription is no longer needed, but the selected model is still billed on the aicentos side — check the balance on the wallet page first.