Skip to contentToken MarketDocs

Grok CLI

Last updated: 2026-08-03; third-party tools can change at any time. If configuration fails, follow the latest official documentation.

Grok CLI is a community-maintained terminal coding assistant, not an official xAI product. The current maintained project is superagent-ai/grok-cli; review its README and security notes before installing it.

Installation and configuration

# Review the official repository install script before using it in an enterprise environment
curl -fsSL https://raw.githubusercontent.com/superagent-ai/grok-cli/main/install.sh | bash
# Or install the npm package directly when Bun is available
bun add -g grok-dev

export GROK_BASE_URL="https://api.tokensmarket.ai/v1"
export GROK_API_KEY="<YOUR_TOKEN_MARKET_API_KEY>"
export GROK_MODEL="<MODEL_ID>"
Environment VariablePurpose
GROK_BASE_URLToken Market unified API endpoint.
GROK_API_KEYWorkspace API Key; store it only in the current terminal session or a secrets manager.

start up

grok --model <MODEL_ID> -d /path/to/your/project

The maintainers optimize this tool for the xAI API. General chat and coding tools can use an OpenAI-compatible endpoint, but a third-party gateway may not support xAI-specific capabilities such as X search, media generation, and voice. If commands or variable names change, follow the GitHub README. Do not put export statements in public scripts.

Was this page helpful?