First, enter claude --version in the terminal to display the Claude code version number before you can configure it.
Method 1 (Recommended): Configure directly through environment variables.
Edit ~/.zshrc or ~/.bashrc
export ANTHROPIC_BASE_URL=https://ailink.nativex.com
export ANTHROPIC_API_KEY=sk-xxxx(Your actual key)
配置后执行:source ~/.zshrc或 source ~/.bashrc
Method 2: Edit ~/.claude/settings.json
Edit ~/.claude/settings.json. If this file does not exist, you need to create it manually first:
The following baseURL, apiKey, and models need to be replaced with the real API Key data actually applied for in the NL system.
1. Using Claude-related Models
Use Claude-related models, such as claude-sonnet-4.6 and claude-opus-4.6 series:
ANTHROPIC_API_KEY is the apiKey, and ANTHROPIC_BASE_URL is the baseURL.
To switch models, enter the /model command in the Claude code.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-xxx",
"ANTHROPIC_BASE_URL": "https://ailink.nativex.com",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_FABLE_MODEL_NAME": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "claude-haiku-4-5-20251001",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_MODEL": "claude-opus-4-8"
},
"model": "opus"
}
2. Using a non-Claude model
Using a non-Claude model, such as gpt-5.4-nano: Where ANTHROPIC_AUTH_TOKEN is the apiKey, ANTHROPIC_BASE_URL is the baseURL, and ANTHROPIC_MODEL is the selected model name.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-gxxx",
"ANTHROPIC_BASE_URL": "https://ailink.nativex.com",
"ANTHROPIC_MODEL": "gpt-5.4-nano"
}
}
(b) (Optional) Edit ~/.claude.json and add the following configuration: (When Claude Code starts for the first time, there will be an onboarding process that requires connecting to the Anthropic official service. If your network environment cannot directly access Anthropic, it will report an "Unable to connect to Anthropic services" error and get stuck on the onboarding page.
Setting hasCompletedOnboarding: true tells Claude Code "I have completed the onboarding" and skips this step, allowing you to directly enter the user interface.)
{
"hasCompletedOnboarding": true
}
c) Save and reopen the terminal for the changes to take effect.
d) Switching models can be done in three ways:
claude --model <model name> in the terminal, specifying the model, and launch Claude Code. For example, claude --model gemini-2.5-flash./model <model name> in the dialog box to switch models. For example, /model claude-opus-4.6. Note that the system can only select official Anthropic models here.~/.claude/settings.json, modify the model parameter to the specified model, and restart Claude Code.For detailed configuration instructions, please refer to the official link: https://code.claude.com/docs/en/llm-gateway#other-llm-gateways