
Claude Code
Your AI pair programmer that lives in the terminal
Connect with the TokenMix CLI
The official TokenMix CLI sets this up in one command — no manual environment variables:
npx tokenmix claude-code
It signs you in and points Claude Code at TokenMix for you. Prefer to configure it by hand? The full steps are below.
Introduction
Claude Code is Anthropic's official command-line coding agent. It runs entirely in your terminal and can read files, write code, run shell commands, and reason across your entire codebase — all powered by Claude models. By pointing it at TokenMix's API, you get access to every Claude model without a separate Anthropic subscription.
Prerequisites
- macOS 13+, Ubuntu 20.04+, or Windows 10/11 (WSL recommended)
- Node.js 18 or later — run
node -vto confirm - A TokenMix account with an API key starting with
sk-tm-→ Register at tokenmix.ai → Dashboard → API Keys
Setup Steps
1. Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash
Verify the installation:
claude --version
2. Configure TokenMix as the API provider
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from your environment. Add both to your shell profile (~/.zshrc, ~/.bashrc, etc.):
export ANTHROPIC_BASE_URL="https://api.tokenmix.ai/v1"
export ANTHROPIC_AUTH_TOKEN="sk-tm-your-key-here"
Reload your shell:
source ~/.zshrc # or source ~/.bashrc
3. Launch Claude Code
Open any project directory and start the agent:
cd ~/your-project
claude
4. Select a model (optional)
By default Claude Code uses claude-sonnet-4-6. To switch models, use the /model command inside the session, or set the environment variable before launching:
ANTHROPIC_MODEL="claude-opus-4.8" claude
Recommended TokenMix models: claude-opus-4.8, claude-sonnet-4-6, claude-haiku-4.5
Verify
Run a quick test inside a project directory:
claude -p "List the top-level files in this directory and briefly describe each one."
You should see Claude enumerate and describe your files. If it errors, run claude doctor to diagnose the setup.
FAQ
Q: Do I need an Anthropic account?
No. You only need a TokenMix account. The ANTHROPIC_AUTH_TOKEN variable sends your sk-tm- key as the Bearer token to api.tokenmix.ai.
Q: Can I use Claude Code in VS Code? Yes. Install the Claude Code VS Code extension from the marketplace, then set the same two environment variables in your OS environment before launching VS Code.
Q: Why is ANTHROPIC_API_KEY not used here?
ANTHROPIC_AUTH_TOKEN overrides the default Authorization header directly, which is what TokenMix expects. Both work, but ANTHROPIC_AUTH_TOKEN takes precedence and is more explicit.