Connecting Claude Code CLI
Difficulty ⌨️ Intermediate (command line) | API format Claude | base_url
https://byesu.com
https://byesu.comclaude-opus-4-8Claude Code is Anthropic's official command-line coding assistant. By default it connects to Anthropic; two environment variables point it at byesu — an AI API gateway with Anthropic-native and OpenAI-compatible endpoints. One key covers Claude, GPT-5.6, Grok, Gemini and more, billed pay-as-you-go with no subscription.
Before you start
First go to Console → Tokens and create a token in the Claude group (see Choosing a Group). Replace the sk-xxxx below with your own.
Step 1: Install Claude Code
Pick either method:
curl -fsSL https://claude.ai/install.sh | bashnpm install -g @anthropic-ai/claude-codeThe npm route requires Node.js 18+ first (if you don't have it, download the LTS version from nodejs.org). Windows users also need to install Git for Windows beforehand — Claude Code depends on Git Bash and will fail to start without it.
Once installed, verify it:
claude --versionStep 2: Point it at byesu (pick one)
Option 1: One-click script (fastest, recommended)
We've already written the gateway endpoint into the script for you — after running it, just paste your API Key (sk-xxxx) and it will automatically set both the ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY environment variables:
iex (irm 'https://docs.byesu.com/setup/claude.ps1')curl -fsSL https://docs.byesu.com/setup/claude.sh | bashOption 2: Set the two environment variables manually
# Add to ~/.zshrc or ~/.bashrc, then reopen your terminal for it to take effect
export ANTHROPIC_BASE_URL="https://byesu.com"
export ANTHROPIC_API_KEY="sk-your-token"setx ANTHROPIC_BASE_URL "https://byesu.com"
setx ANTHROPIC_API_KEY "sk-your-token"
# Takes effect after you reopen PowerShellNote
ANTHROPIC_BASE_URLishttps://byesu.com(Anthropic-native format, no/v1). The OpenAI-compatible endpointhttps://byesu.com/v1also exists, but it is for OpenAI-format clients — Claude Code speaks the Anthropic format.- If a particular version fails to authenticate, try swapping
ANTHROPIC_API_KEYforANTHROPIC_AUTH_TOKEN.
Step 3: Choose a model (optional)
After starting Claude Code, type /model to switch models. You can also set a default with an environment variable:
export ANTHROPIC_MODEL="claude-opus-4-8" # the strongest right now; or any other Claude model in the consoleBilling is pay-as-you-go per token. The console shows your live billed price next to the official list price, and it follows automatically whenever multipliers change.
Step 4: Run it and verify
Go into any project directory and start it:
claudeAsk it to do something small (for example, "list the files in the current directory"). If it answers normally, you're connected ✅

Stuck?
- 401 / invalid token → The Key is wrong, or try swapping
ANTHROPIC_API_KEYforANTHROPIC_AUTH_TOKEN(details) - No available channel → The token isn't in the Claude group (Choosing a Group, details)
- Insufficient balance → Top up in the console with USDT or Alipay (details)
- For other issues, see Common Errors & Solutions
