Appearance
Linux/macOS System Configuration
This guide explains common ways to configure Claude Code third-party API environment variables on Linux and macOS. Replace sk-xxxx-uocode with the API key you created in Yusr.ai token management.
Option 1: Shell Configuration File (Permanent)
Bash (Linux and older macOS)
Edit ~/.bashrc:
bash
nano ~/.bashrcOr use your preferred editor:
bash
vim ~/.bashrcAdd these lines to the end of the file:
bash
# Claude Code third-party API configuration
export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"
export ANTHROPIC_BASE_URL="https://www.yusr.ai"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"Save the file, then run:
bash
source ~/.bashrcVerify the variables:
bash
echo $ANTHROPIC_AUTH_TOKEN
echo $ANTHROPIC_BASE_URLZsh (default on macOS Catalina and later)
Edit ~/.zshrc:
bash
nano ~/.zshrcAdd these lines to the end of the file:
bash
# Claude Code third-party API configuration
export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"
export ANTHROPIC_BASE_URL="https://www.yusr.ai"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"Save the file, then run:
bash
source ~/.zshrcFish Shell
Edit ~/.config/fish/config.fish:
bash
nano ~/.config/fish/config.fishAdd these lines to the end of the file:
fish
# Claude Code third-party API configuration
set -gx ANTHROPIC_AUTH_TOKEN "sk-xxxx-uocode"
set -gx ANTHROPIC_BASE_URL "https://www.yusr.ai"
set -gx CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC "1"Save the file and restart Fish Shell.
Option 2: Temporary Setup (Current Terminal Session)
Use this method if you only want the variables to apply in the current terminal session:
bash
export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"
export ANTHROPIC_BASE_URL="https://www.yusr.ai"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
# Verify
echo $ANTHROPIC_AUTH_TOKEN
echo $ANTHROPIC_BASE_URL
# Start Claude Code
claudeThe variables are lost after you close the terminal.
Option 3: Project-Level Configuration (.env + Startup Script)
Step 1: Create a .env file in your project root
bash
cd your-awesome-project
cat > .env << 'EOF'
ANTHROPIC_AUTH_TOKEN=sk-xxxx-uocode
ANTHROPIC_BASE_URL=https://www.yusr.ai
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
EOFStep 2: Create run-claude.sh
bash
cat > run-claude.sh << 'EOF'
#!/bin/bash
# Load environment variables from .env
if [ -f .env ]; then
echo "Loading environment variables..."
export $(cat .env | xargs)
echo "Environment variables loaded"
else
echo "Warning: .env file not found"
fi
# Verify environment variables
echo "Current configuration:"
echo "ANTHROPIC_AUTH_TOKEN: $ANTHROPIC_AUTH_TOKEN"
echo "ANTHROPIC_BASE_URL: $ANTHROPIC_BASE_URL"
# Start Claude Code
echo "Starting Claude Code..."
claude
EOFStep 3: Make the script executable
bash
chmod +x run-claude.shStep 4: Run the script
bash
./run-claude.shStep 5 (Optional): Create a system shortcut
bash
# Create a symlink in the user bin directory
ln -s $(pwd)/run-claude.sh ~/bin/my-claude
# Verify
which my-claude
# Then use it from anywhere
my-claudeEdit settings.json (Recommended, More Visual)
If you use Claude Code in VS Code, Cursor, or other compatible editors, you can configure the environment variables in settings.json instead of editing shell startup files.
Open the editor settings JSON file, then add or update the following configuration:
json
{
"claudeCode.allowDangerouslySkipPermissions": true,
"claudeCode.environmentVariables": [
{
"name": "ANTHROPIC_AUTH_TOKEN",
"value": "sk-xxxx-uocode"
},
{
"name": "ANTHROPIC_BASE_URL",
"value": "https://www.yusr.ai"
},
{
"name": "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
"value": "1"
}
],
"claudeCode.preferredLocation": "panel",
"claudeCode.initialPermissionMode": "bypassPermissions",
"claudeCode.selectedModel": "claude-haiku-4-5-20251001"
}After saving the file, restart the editor and open Claude Code again.
Command Line CLI Usage
If you use Claude Code directly in the terminal, set the environment variables before running claude:
bash
export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"
export ANTHROPIC_BASE_URL="https://www.yusr.ai"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
claudeYou can also specify a model when launching Claude Code:
bash
ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode" ANTHROPIC_BASE_URL="https://www.yusr.ai" CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1" claude -m claude-haiku-4-5-20251001To verify the CLI installation:
bash
claude --version
claude doctorQuick Start
For Bash, you can run:
bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"' >> ~/.bashrc
echo 'export ANTHROPIC_BASE_URL="https://www.yusr.ai"' >> ~/.bashrc
echo 'export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"' >> ~/.bashrc
source ~/.bashrc
claudeFor Zsh, replace ~/.bashrc with ~/.zshrc.