Skip to main content

Claude Code

Overview​

Claude Code is Anthropic's command-line coding agent that runs in your terminal, reading the repo structure, editing files, and running commands. With just three environment variables you can point its requests at TokenPlus's compatible endpoint and use its Claude-series and other models.

Installation​

  1. Install Node.js 18+ first (LTS is more stable)
  2. Run npm install -g @anthropic-ai/claude-code in the terminal
  3. Run claude --version; a version number means the install succeeded

Configure TokenPlus​

Claude Code uses ANTHROPIC_BASE_URL with only the root domain (no /v1); it appends /v1/messages automatically. Write that variable together with the key and model name into your shell config or settings.json.

# Temporary (current terminal)
export ANTHROPIC_BASE_URL="https://tokenplus.net"
export ANTHROPIC_AUTH_TOKEN="sk-your-TokenPlus-key"
export ANTHROPIC_MODEL="claude-sonnet-4-6"

# Permanent: append to ~/.zshrc / ~/.bashrc
echo 'export ANTHROPIC_BASE_URL="https://tokenplus.net"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-TokenPlus-key"' >> ~/.zshrc
echo 'export ANTHROPIC_MODEL="claude-sonnet-4-6"' >> ~/.zshrc
source ~/.zshrc
// ~/.claude/settings.json (only affects Claude Code, more isolated)
{
"env": {
"ANTHROPIC_BASE_URL": "https://tokenplus.net",
"ANTHROPIC_AUTH_TOKEN": "sk-your-TokenPlus-key",
"ANTHROPIC_MODEL": "claude-sonnet-4-6"
}
}
tip

ANTHROPIC_BASE_URL must be the root domain https://tokenplus.net without /v1; Claude Code appends /v1/messages itself. After setting, do not log in with an Anthropic account on first launch - use the TokenPlus credentials directly.

Quick start (up and running in 5 minutes)​

  1. Install Node.js 18+ and claude-code (npm i -g)
  2. Export the three environment variables above and source the config file
  3. Run claude in your project directory and confirm theme / directory trust as prompted on first launch
  4. Type "Hello" to verify the model replies normally - connection succeeded

FAQ​

  • Cannot reach API? Check the network and whether ANTHROPIC_BASE_URL is the root domain
  • Token failed? Confirm the Key starts with sk- and has not expired
Online Service