Claude Code Configuration Guide
Claude Code uses the Anthropic Messages protocol. When connecting to ai2save, enter the site root address https://ai2save.com, do not manually append /v1; use the sk-... created in the ai2save console as the key.
1. Prepare API Key
- Open https://ai2save.com/keys.
- Click "Create Key", fill in the name, and select a group that includes the Claude model.
- Copy the complete key immediately after creation. The complete key is shown only once.
2. Install Claude Code
First complete the Node.js environment setup, then run:
npm install -g @anthropic-ai/claude-code
claude --version
If the version is lower than the gateway requirements, upgrade as prompted:
npm update -g @anthropic-ai/claude-code
3. Temporarily Enable on Current Terminal
macOS / Linux / WSL:
export ANTHROPIC_BASE_URL="https://ai2save.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-api-key"
claude
Windows PowerShell:
$env:ANTHROPIC_BASE_URL="https://ai2save.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-your-api-key"
claude
ANTHROPIC_AUTH_TOKEN is a special variable for the transit station key. Do not set ANTHROPIC_API_KEY to any other official Key at the same time, to avoid Claude Code reading incorrect credentials.
4. Write to the Claude Code configuration file (recommended)
Edit ~/.claude/settings.json (on Windows, usually in %USERPROFILE%\.claude\settings.json):
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://ai2save.com",
"ANTHROPIC_AUTH_TOKEN": "sk-your-api-key"
}
}
After saving, reopen the terminal and start claude. If you only want it to take effect for a specific project, write the same content into .claude/settings.local.json within the project, and do not submit the real Key to Git.
5. Select a model and verify
claude --model claude-sonnet-4-6
After entering the interactive interface:
- Enter a short question, such as "Hello, introduce yourself."
- If content is returned normally, it indicates that the address, key, and model group are connected.
- To switch models, use
/model, and the model ID must match the ID opened in the console.
You can also first use the built-in diagnostic Claude Code to check the configuration status:
/status
/doctor
6. Multiple Configurations and Old Configuration Cleanup
If you have previously logged in to the official Claude or other relay stations:
- Prioritize using CC Switch to manage multiple vendors to avoid manual misconfiguration.
- When configuring manually, make sure that old
ANTHROPIC_BASE_URL,ANTHROPIC_AUTH_TOKEN, orANTHROPIC_API_KEYare not overriding the current values. - WSL and Windows are two separate environments; after configuring in the Windows terminal, WSL also needs to be configured separately.
macOS / Linux temporary cleanup:
unset ANTHROPIC_API_KEY
Common Errors
- 401 / invalid_api_key: The key was not fully copied, has been revoked, or the group does not include the current model.
- 404 / model not found: The model ID is incorrect, or the key group has not enabled this model.
- Connection failed: Writing Base URL as
https://ai2save.com/v1will cause an error; Claude Code should be filled ashttps://ai2save.com. - Still trying to request the official address: Check whether the old address remains in
~/.claude/settings.json, project.claude/settings.local.json, or terminal environment variables. - Windows does not take effect after opening: Completely exit the terminal, VS Code, or Claude Desktop, and then reopen.