Skip to content

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 UoCode token management.

Option 1: Shell Configuration File (Permanent) ​

Bash (Linux and older macOS) ​

Edit ~/.bashrc:

bash
nano ~/.bashrc

Or use your preferred editor:

bash
vim ~/.bashrc

Add 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.uocode.com"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

Save the file, then run:

bash
source ~/.bashrc

Verify the variables:

bash
echo $ANTHROPIC_AUTH_TOKEN
echo $ANTHROPIC_BASE_URL

Zsh (default on macOS Catalina and later) ​

Edit ~/.zshrc:

bash
nano ~/.zshrc

Add 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.uocode.com"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

Save the file, then run:

bash
source ~/.zshrc

Fish Shell ​

Edit ~/.config/fish/config.fish:

bash
nano ~/.config/fish/config.fish

Add 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.uocode.com"
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.uocode.com"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

# Verify
echo $ANTHROPIC_AUTH_TOKEN
echo $ANTHROPIC_BASE_URL

# Start Claude Code
claude

The 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.uocode.com
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
EOF

Step 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
EOF

Step 3: Make the script executable ​

bash
chmod +x run-claude.sh

Step 4: Run the script ​

bash
./run-claude.sh

Step 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-claude

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.uocode.com"
    },
    {
      "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.uocode.com"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

claude

You can also specify a model when launching Claude Code:

bash
ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode" ANTHROPIC_BASE_URL="https://www.uocode.com" CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1" claude -m claude-haiku-4-5-20251001

To verify the CLI installation:

bash
claude --version
claude doctor

Quick Start ​

For Bash, you can run:

bash
echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxxx-uocode"' >> ~/.bashrc
echo 'export ANTHROPIC_BASE_URL="https://www.uocode.com"' >> ~/.bashrc
echo 'export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"' >> ~/.bashrc
source ~/.bashrc
claude

For Zsh, replace ~/.bashrc with ~/.zshrc.

Released under the MIT License.