Grok CLI is the console agent from xAI: repository xai-org/grok-build, command grok. A third-party address is not a workaround here but a documented feature: your own model is declared as an entry with its own address, its own key and its own protocol.
curl -fsSL https://x.ai/cli/install.sh | bashSettings live in ~/.grok/config.toml. Every custom model is one [model.<name>] entry. In it, model is the exact id sent to the server, base_url is the address, env_key names the environment variable holding the key, and api_backend picks the protocol. It has exactly three values: chat_completions by default, responses and messages.
# ~/.grok/config.toml
[model.guard]
model = "claude-sonnet-5"
name = "Guard Claude Sonnet 5"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
api_backend = "chat_completions"
max_completion_tokens = 8192
context_window = 1000000# ~/.grok/config.toml
[model.guard]
model = "k3"
name = "Guard Kimi K3"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
api_backend = "chat_completions"
max_completion_tokens = 8192
context_window = 1048576# ~/.grok/config.toml
[model.guard]
model = "cursor-grok-4.6-medium"
name = "Guard Grok 4.6"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
api_backend = "chat_completions"
max_completion_tokens = 8192
context_window = 500000# ~/.grok/config.toml
[model.guard]
model = "composer-2.5"
name = "Guard Composer 2.5"
base_url = "https://api.guardrelay.ai/v1"
env_key = "GUARD_API_KEY"
api_backend = "chat_completions"
max_completion_tokens = 8192
context_window = 200000The key goes into the variable named by env_key, or straight into the api_key field of the same entry. The client takes api_key first, then the variable from env_key, and only then its own xAI sign-in and the shared XAI_API_KEY variable.
A one-off run: grok -p "hello" -m guard. Inside a session the model is switched with /model guard, grok models lists what is available, and a permanent default is set by a separate [models] entry with a default field.