> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bettertoken.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok CLI BetterToken setup guide

> Connect BetterToken to Grok CLI with Codex group model IDs.

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.

<Warning>
  Grok CLI is better suited to lightweight usage. For full agent workflows, prefer Claude Code, Codex, or OpenClaw.
</Warning>

## Prerequisites

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

## Install Grok CLI

```bash theme={null}
npm install -g @vibe-kit/grok-cli
```

## Setup

<Steps>
  <Step title="Clear conflicting environment variables">
    ```bash theme={null}
    unset OPENAI_API_KEY
    unset OPENAI_BASE_URL
    ```
  </Step>

  <Step title="Set BetterToken environment variables">
    ```bash theme={null}
    export GROK_BASE_URL="https://www.bettertoken.ai/v1"
    export GROK_API_KEY="YOUR_API_KEY"
    ```
  </Step>

  <Step title="Start Grok CLI with a model">
    ```bash theme={null}
    grok --model YOUR_CODEX_MODEL_ID
    ```

    Replace `YOUR_CODEX_MODEL_ID` with a current **Codex group** model ID copied from the model plaza (`https://www.bettertoken.ai/pricing`).
  </Step>

  <Step title="Restart Grok CLI">
    After changing the environment variables, close the current Grok CLI session and start the tool again.
  </Step>
</Steps>

<Note>
  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.
</Note>
