Claude Code — Terminal AI Assistant Setup
Set up Claude Code CLI against the ClaudeStore api2.claudestore.store gateway. Use ANTHROPIC_API_KEY with an sk-cs2 key — no Anthropic account or OAuth required.
ANTHROPIC_BASE_URL: https://api2.claudestore.store. ANTHROPIC_API_KEY: sk-cs2-*. Subscription required: No. Minimum top-up: $5.
1. Install the CLI
Install the official @anthropic-ai/claude-code package globally:
npm install -g @anthropic-ai/claude-codeVerify the binary is on your $PATH:
claude --version2. Get an API Key
The Claude Code gateway uses v2 keys with the prefix sk-cs2-:
- Open the Gateway v2 → Keys page in the dashboard
- Click New v2 key, give it a name, and copy the
sk-cs2-…value (shown once) - Top up the v2 credit pool from the Plans page if needed
sk-cs2-… on api2.claudestore.store) are billed separately and are not used for the Claude Code setup below.3. Set Environment Variables
Linux / macOS
export ANTHROPIC_BASE_URL="https://api2.claudestore.store"
export ANTHROPIC_API_KEY="YOUR_SK_CS2_KEY"
export ANTHROPIC_MODEL="claude-sonnet-4.6"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4.5"
export DISABLE_TELEMETRY=1
export DISABLE_AUTOUPDATER=1Reload your shell with source ~/.zshrc (or ~/.bashrc).
Windows PowerShell
$env:ANTHROPIC_BASE_URL = "https://api2.claudestore.store"
$env:ANTHROPIC_API_KEY = "YOUR_SK_CS2_KEY"
$env:ANTHROPIC_MODEL = "claude-sonnet-4.6"
$env:ANTHROPIC_SMALL_FAST_MODEL = "claude-haiku-4.5"
$env:DISABLE_TELEMETRY = "1"
$env:DISABLE_AUTOUPDATER = "1"4. User-Level Settings File
Create ~/.claude/settings.json so Claude Code picks the same configuration even when env vars are not loaded (e.g. inside the VS Code extension):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api2.claudestore.store",
"ANTHROPIC_API_KEY": "YOUR_SK_CS2_KEY",
"ANTHROPIC_MODEL": "claude-sonnet-4.6",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4.5",
"DISABLE_TELEMETRY": "1",
"DISABLE_AUTOUPDATER": "1"
}
}Use only ANTHROPIC_API_KEY
ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN. For ClaudeStore use only ANTHROPIC_API_KEY.ANTHROPIC_AUTH_TOKEN is reserved for Anthropic's OAuth-based Claude Pro/Max login and will not authenticate against this gateway.5. Project-Level Override (optional)
If a repository ships its own .claude/settings.json at the project root, it will be merged on top of the user-level file. Make sure both agree — otherwise the project file silently overrides your global config:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api2.claudestore.store",
"ANTHROPIC_API_KEY": "YOUR_SK_CS2_KEY",
"ANTHROPIC_MODEL": "claude-sonnet-4.6",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4.5",
"DISABLE_TELEMETRY": "1",
"DISABLE_AUTOUPDATER": "1"
},
"model": "claude-sonnet-4.6"
}6. Verify the Connection
Run all three checks before launching the CLI for the first time:
curl https://api2.claudestore.store/healthzcurl https://api2.claudestore.store/v1/models \
-H "Authorization: Bearer $ANTHROPIC_API_KEY"claude --print "reply with exactly: pong"You should see pong in stdout. If you do, the gateway, key, and model resolution are all working.
Troubleshooting
Project settings override user settings
A project-level .claude/settings.json at the repository root takes precedence over ~/.claude/settings.json. If the CLI suddenly stops connecting after switching directories, check whether the project ships its own settings file pointing at a different base URL or key.
Custom API key was previously rejected
If Claude Code refused this key in an earlier session (for example after an auth error), it stores the key fingerprint as rejected inside ~/.claude.json. Subsequent runs will keep blocking that key or repeatedly ask you to confirm it.
Fix: open ~/.claude.json and either approve the custom API key explicitly, or move its fingerprint from the rejected list into the approved list. Then restart the CLI.
401 / 403 from the gateway
The key is wrong, revoked, or you are sending it as ANTHROPIC_AUTH_TOKEN. Re-export it as ANTHROPIC_API_KEY and confirm it appears in env | grep ANTHROPIC.
Common Claude Code configuration mistakes
UI model and ANTHROPIC_MODEL conflict
One of the most common mistakes: you pick a model in the Claude Code UI (for example opus[1m]), but the requests on the wire actually go out as a different model (for example claude-sonnet-4.6). The 1M context window or the selected effort never seem to apply.
This usually happens when ~/.claude/settings.json contains both:
- a top-level
"model": "opus[1m]"(the UI / picker selection), and - an
env.ANTHROPIC_MODELthat points at a different model.
ANTHROPIC_MODEL is an environment override and will win over the UI selection for outgoing requests.ANTHROPIC_SMALL_FAST_MODEL is similar but only affects internal small/fast paths (summaries, lightweight steps) — it is not necessarily a bug, but it explains why some calls go to a different, cheaper model.
Pick one source of truth for the model
ANTHROPIC_MODEL at the same time if you expect the picker to be authoritative.Recommended configurations
Option 1 — let the UI / picker control the model (do not set ANTHROPIC_MODEL):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api2.claudestore.store",
"ANTHROPIC_API_KEY": "YOUR_SK_CS2_KEY",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4.5"
},
"model": "opus[1m]"
}Option 2 — hard-pin a single model for every request via ANTHROPIC_MODEL:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api2.claudestore.store",
"ANTHROPIC_API_KEY": "YOUR_SK_CS2_KEY",
"ANTHROPIC_MODEL": "claude-opus-4.6"
}
}Reserve ANTHROPIC_SMALL_FAST_MODEL for the small/fast model behavior only — don't use it as your main model.
Checklist: wrong model is being used
If any of the following is happening:
- the model shown in the UI doesn't match the model you see being charged,
- the
1mcontext flag isn't applied, - your effort setting doesn't seem to take effect,
- Sonnet is used unexpectedly instead of Opus (or vice versa).
Check, in this order:
~/.claude/settings.json— doesenv.ANTHROPIC_MODELconflict with the top-level"model"?.claude/settings.jsonin the project root — same check, project file wins over the user file.- Shell environment:
env | grep ANTHROPIC— anyANTHROPIC_MODELorANTHROPIC_SMALL_FAST_MODELexported from~/.zshrc/~/.bashrc/ PowerShell profile? - VS Code / Claude Code extension settings — the extension may inherit its own environment with an
ANTHROPIC_MODELoverride.
Remove the conflicting override (or align both values), restart the CLI / VS Code, and try again.
Windows setup (full walkthrough)
The Linux/macOS instructions above work on Windows too, but PATH, env vars, and config paths behave differently. This section is a standalone Windows recipe.
1. Install Node.js LTS
Download the LTS installer from nodejs.org. Open a fresh PowerShell window and verify:
node -v
npm -v2. Install Claude Code globally
npm install -g @anthropic-ai/claude-code
claude --versionIf claude is "not recognized", reopen PowerShell — npm's global bin folder (%APPDATA%\npm) is added to PATH only in new shells.
3. Persist environment variables
$env:... only lives in the current shell. Use setx to write them permanently to your user profile:
setx ANTHROPIC_BASE_URL "https://api2.claudestore.store"
setx ANTHROPIC_API_KEY "YOUR_SK_CS2_KEY"
setx ANTHROPIC_MODEL "claude-sonnet-4.6"
setx ANTHROPIC_SMALL_FAST_MODEL "claude-haiku-4.5"
setx DISABLE_TELEMETRY "1"
setx DISABLE_AUTOUPDATER "1"GUI alternative: Win+R → sysdm.cpl → Advanced → Environment Variables → User variables.
setx never updates the current terminal. Close it, open a new PowerShell, then run claude.4. settings.json on Windows
Claude Code reads %USERPROFILE%\.claude\settings.json (e.g. C:\Users\<you>\.claude\settings.json). Create the folder and file:
mkdir $env:USERPROFILE\.claude -ErrorAction SilentlyContinue
notepad $env:USERPROFILE\.claude\settings.jsonPaste the same JSON shown in section 4 above.
5. WSL / Remote-WSL
Variables set with setx do NOT propagate into WSL. Inside the WSL distro, also add to ~/.bashrc:
export ANTHROPIC_BASE_URL="https://api2.claudestore.store"
export ANTHROPIC_API_KEY="YOUR_SK_CS2_KEY"
export ANTHROPIC_MODEL="claude-sonnet-4.6"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4.5"6. Windows-specific troubleshooting
- "claude is not recognized" — open a new PowerShell, or add
%APPDATA%\npmto PATH manually. - PowerShell quoting — always wrap values in double quotes; cmd.exe quoting is different and breaks URLs.
- Corporate proxy:
setx HTTPS_PROXY "http://proxy.company:8080". - Antivirus / SmartScreen — whitelist
api2.claudestore.storeand thenode.exebinary. - Long path errors on global npm install — enable Win10/11 long paths via
git config --system core.longpaths trueor the LongPathsEnabled registry tweak.