Skip to content

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

ItemValue
Node.js≥ 18 (LTS recommended)
Base URLhttps://ai.afp.net (do not add /v1)
Recommended modelclaude-sonnet-4-6 (everyday); claude-opus-4-8 for complex tasks
Fast modelclaude-haiku-4-5

1. Environment setup ​

bash
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 --lts

On 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 ​

bash
npm install -g @anthropic-ai/claude-code
claude --version

4. Write the configuration ​

Edit ~/.claude/settings.json (create it if it does not exist; on Windows: %USERPROFILE%\.claude\settings.json):

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 /v1
  • ANTHROPIC_AUTH_TOKEN: your sk- token (some versions also accept ANTHROPIC_API_KEY)
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1: reduces non-essential telemetry traffic
  • alwaysThinkingEnabled: 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:

bash
export ANTHROPIC_BASE_URL="https://ai.afp.net"
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"

5. Verify ​

bash
cd /path/to/your/project
claude
# inside the session, use /model to switch, e.g. claude-opus-4-8

Or:

bash
claude -p "describe what the current directory is for in one sentence"

6. Troubleshooting ​

SymptomFix
Can't connect / 404Check whether the Base URL has an extra /v1; restart the terminal after fixing it
invalid beta flagAdd "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
Node version too oldUpgrade to 18+ and reinstall the CLI
Permission errorsAvoid casual sudo npm; configure a user-level npm global directory
Insufficient quotaCheck the balance and token quota in the console
Model not foundVerify the ID against /v1/models; check the token group

For available Claude models, see Help Center.


Back to: Help Center