Skip to main content
Grok CLI uses environment variables for API configuration. When connecting BetterToken, use https://www.bettertoken.ai/v1 and a model ID from the Codex group.
Grok CLI is better suited to lightweight usage. For full agent workflows, prefer Claude Code, Codex, or OpenClaw.

Prerequisites

  • Node.js installed
  • BetterToken API Key (register here (https://www.bettertoken.ai/register))

Install Grok CLI

Setup

1

Clear conflicting environment variables

2

Set BetterToken environment variables

3

Start Grok CLI with a model

Replace YOUR_CODEX_MODEL_ID with a current Codex group model ID copied from the model plaza (https://www.bettertoken.ai/pricing).
4

Restart Grok CLI

After changing the environment variables, close the current Grok CLI session and start the tool again.
We did not find an official Grok CLI setup requirement that makes User-Agent mandatory for BetterToken. Check the environment variables, model ID, and tool version first; only add headers when your upstream gateway explicitly requires them.