Claude Code CLI Configuration Guide
Last updated: October 17, 2026 (Asia/Shanghai)
Related: Help Center · VS Code / Cursor · LLM API
Applies to: using Anthropic Claude Code in the terminal for agentic programming, with requests routed to TokenExplore.
Key settings
| Item | Value |
|---|---|
| Node.js | ≥ 18 (LTS recommended) |
| Base URL | https://ai.afp.net (do not add /v1) |
| Recommended model | claude-sonnet-4-6 (everyday); claude-opus-4-8 for complex tasks |
| Fast model | claude-haiku-4-5 |
1. Environment setup
node --version # should be ≥ v18
# if it is too old, use nvm:
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# nvm install --lts && nvm use --ltsOn Windows, use winget install OpenJS.NodeJS.LTS or nvm-windows.
2. Get a token
Create a token in the console under "Token Management" (e.g. named claude-code) and copy the sk- key. A dedicated token with a quota cap is recommended.
3. Install
npm install -g @anthropic-ai/claude-code
claude --version4. Write the configuration
Edit ~/.claude/settings.json (create it if it does not exist; on Windows: %USERPROFILE%\.claude\settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "https://ai.afp.net",
"ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxx",
"ANTHROPIC_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [],
"deny": []
},
"alwaysThinkingEnabled": true
}Notes:
ANTHROPIC_BASE_URL: the TokenExplore root URL, without/v1ANTHROPIC_AUTH_TOKEN: yoursk-token (some versions also acceptANTHROPIC_API_KEY)CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1: reduces non-essential telemetry trafficalwaysThinkingEnabled: enables thinking by default (uses more tokens; toggle it according to your budget)
Optional: if ~/.claude.json exists, you can set "hasCompletedOnboarding": true to skip onboarding; when the file already exists, only add or modify fields — never overwrite the whole file.
You can also apply the settings temporarily with environment variables:
export ANTHROPIC_BASE_URL="https://ai.afp.net"
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"5. Verify
cd /path/to/your/project
claude
# inside the session, use /model to switch, e.g. claude-opus-4-8Or:
claude -p "describe what the current directory is for in one sentence"6. Troubleshooting
| Symptom | Fix |
|---|---|
| Can't connect / 404 | Check whether the Base URL has an extra /v1; restart the terminal after fixing it |
invalid beta flag | Add "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1" |
| Node version too old | Upgrade to 18+ and reinstall the CLI |
| Permission errors | Avoid casual sudo npm; configure a user-level npm global directory |
| Insufficient quota | Check the balance and token quota in the console |
| Model not found | Verify the ID against /v1/models; check the token group |
For available Claude models, see Help Center.
Back to: Help Center