Connecting Claude Code CLI
Difficulty ⌨️ Intermediate (command line) | API format Claude | base_url
https://byesu.si
https://byesu.siclaude-opus-5-5Claude 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). The script writes the settings into Claude Code's own config file, ~/.claude/settings.json, and skips the official sign-in screen: no source, no terminal restart — run claude right away.
iex (irm 'https://docs.byesu.si/setup/claude.ps1')curl -fsSL https://docs.byesu.si/setup/claude.sh | bashThe script also comments out old
ANTHROPIC_*variables in~/.bashrc/~/.zshrc(the original is backed up as*.byesu-bak.<time>) so an old key can't override the new settings; the Windows version removes the user environment variables of the same name.
Option 2: Edit the config files manually
① ~/.claude/settings.json (on Windows: C:\Users\<you>\.claude\settings.json; if the file already exists, just add the env block):
{
"env": {
"ANTHROPIC_BASE_URL": "https://byesu.si",
"ANTHROPIC_AUTH_TOKEN": "sk-your-token"
}
}② ~/.claude.json (also in your home directory): add "hasCompletedOnboarding": true inside the outermost { }, or create the file with:
{
"hasCompletedOnboarding": true
}Without it, the first launch opens the claude.ai sign-in screen (open a link, paste a code). That is Anthropic's own account login — you don't need it with byesu.
Note
ANTHROPIC_BASE_URLishttps://byesu.si(Anthropic-native format, no/v1). The OpenAI-compatible endpointhttps://byesu.si/v1also exists, but it is for OpenAI-format clients — Claude Code speaks the Anthropic format.- Use
ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY: the latter makes Claude Code ask you to confirm the API key first. - An old
ANTHROPIC_API_KEYstill exported in your shell overrides these settings: rununset ANTHROPIC_API_KEY, or delete that line from~/.bashrc/~/.zshrcand open a new terminal.
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-5-5" # 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 an old
ANTHROPIC_API_KEYis still set in your shell (rununset ANTHROPIC_API_KEYor open a new terminal) (details) - Claude Code opens the claude.ai sign-in screen and asks for a code → The settings didn't apply: run the one-click script again, or add
hasCompletedOnboardingto~/.claude.jsonas in Option 2 - 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
