GreenTokens

Search

Search models, guides, docs and the FAQ.

Clients

Grok CLI

Add GreenTokens models to xAI's Grok CLI.

Install

Grok CLI (Grok Build) is xAI's terminal coding agent. It needs Node 20 or newer for the npm install.

npm install -g @xai-official/grok

Add GreenTokens models

Grok CLI supports custom OpenAI-compatible endpoints in its config file. Add one block per GreenTokens model you want to use:

~/.grok/config.toml
[models]
default = "grok-4.7"

[model."grok-4.7"]
model = "grok-4.7"
name = "Grok 4.7 (GreenTokens)"
base_url = "https://api.greentokens.io/v1"
env_key = "GREENTOKENS_API_KEY"
api_backend = "chat_completions"

[model."claude-sonnet-5"]
model = "claude-sonnet-5"
name = "Claude Sonnet 5 (GreenTokens)"
base_url = "https://api.greentokens.io/v1"
env_key = "GREENTOKENS_API_KEY"
api_backend = "chat_completions"
  • model is the GreenTokens model ID sent to the API. Any text model from the models page works, not just Grok.
  • base_url is https://api.greentokens.io/v1: Grok CLI adds /chat/completions itself.
  • env_key names the environment variable holding your key, so it never sits in the file.
Quote block names that contain dots: [model."grok-4.7"], not [model.grok-4.7].

Run it

export GREENTOKENS_API_KEY="sk-gt-…"
grok                    # uses the default model
grok -m claude-sonnet-5 # or pick one

Switch models inside a session with /model or Ctrl+M.