
TokenMix CLI
Official TokenMix CLI — connect any AI coding agent to TokenMix in one command
Overview
TokenMix CLI is the official command-line tool from TokenMix. It lets you connect Claude Code, Aider, OpenCode, Codex, Qwen Code, Goose, OpenHands, and four VS Code extensions (Kilo Code, Cline, Roo Code, Continue) to your TokenMix account in seconds — no manual environment-variable wrangling, no config file editing. One key covers every protocol: OpenAI Chat Completions, Anthropic Messages, and the Responses API.
Prerequisites
- Node.js 18 or newer. Verify with
node --version. Install from nodejs.org if needed. - A TokenMix account. Sign up at tokenmix.ai. New accounts receive $1 free credit (works on most non-premium models including Qwen Flash).
Installation
Option A — global install (recommended for daily use):
npm install -g tokenmix
Option B — run without installing (npx):
npx tokenmix <command>
Behind a package mirror (e.g. mainland China):
npm config set registry https://registry.npmmirror.com
npm install -g tokenmix
Login
tokenmix login
This opens your browser. Sign in to your TokenMix account, then confirm the short code shown in the terminal. Headless / CI environments:
tokenmix login --paste # interactive paste prompt, no browser needed
tokenmix login --key sk-tm-... # supply your API key directly
Your key is stored at ~/Library/Application Support/tokenmix/config.json (macOS), ~/.config/tokenmix/config.json (Linux), or %APPDATA%/tokenmix/config.json (Windows) with permissions 0600 — owner read/write only.
Launch an Agent
Each command installs the agent automatically on first run (where applicable) and points it at TokenMix:
npx tokenmix opencode # OpenCode — installs automatically
npx tokenmix claude # Claude Code — installs automatically
npx tokenmix aider # Aider — requires Python + pip install aider-chat
npx tokenmix codex # Codex — installs automatically
npx tokenmix qwen # Qwen Code — installs automatically
npx tokenmix goose # Goose — install Goose first, then run this
npx tokenmix openhands # OpenHands — install via uv tool install openhands (Python 3.12+)
VS Code extension config (prints the snippet to paste into your extension settings):
npx tokenmix kilo # Kilo Code
npx tokenmix cline # Cline
npx tokenmix roo # Roo Code
npx tokenmix continue # Continue (VS Code / JetBrains)
Use the $1 free trial
The free credit works on non-premium models. Point any agent at qwen-flash for a zero-cost test run:
TOKENMIX_DEFAULT_MODEL=qwen-flash npx tokenmix opencode
Run tokenmix models to see every available model and its price.
Verification
tokenmix balance # shows live balance, gift credit, and total spend
tokenmix doctor # checks key validity and each agent's install/config status
If balance shows your credit and doctor reports no errors, you are ready to code.
Frequently Asked Questions
The browser didn't open during login.
Expected on servers, containers, or SSH sessions. The terminal prints a URL and a short code — open the URL on any device, enter the code. Or skip the browser entirely with tokenmix login --paste or tokenmix login --key sk-tm-....
How do I change the default model?
Agents default to claude-sonnet-4.6. Set TOKENMIX_DEFAULT_MODEL to override it for any launch. Run tokenmix models to list all available models. Note: tokenmix claude and tokenmix codex require a Claude-family model; other agents accept any chat model.
How do I log out or clean up?
tokenmix logout removes your stored key and reverts any agent config the CLI changed. If installed globally, npm uninstall -g tokenmix removes it entirely.