macOS Guide
This guide helps you configure AI coding tools on macOS using Any API as the API gateway.
Step 1: Install Node.js
Method 1: Homebrew (Recommended)
bash
brew install nodeIf Homebrew is not installed:
bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Method 2: Official Website
- Visit https://nodejs.org
- Download the LTS version
.pkgfile and install
Verify Installation
bash
node --version
npm --versionStep 2: Install Claude Code
bash
npm install -g @anthropic-ai/claude-codeVerify installation:
bash
claude --versionStep 3: Set Environment Variables
Check your shell type:
bash
echo $SHELLmacOS Catalina and later use zsh by default.
Method 1: Temporary (Current Session)
bash
export ANTHROPIC_BASE_URL="https://anyapi.pro"
export ANTHROPIC_AUTH_TOKEN="your_api_key"Method 2: zsh Permanent (Recommended)
bash
echo '' >> ~/.zshrc
echo '# API config' >> ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="https://anyapi.pro"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your_api_key"' >> ~/.zshrc
source ~/.zshrcMethod 3: bash Permanent
bash
echo 'export ANTHROPIC_BASE_URL="https://anyapi.pro"' >> ~/.bash_profile
echo 'export ANTHROPIC_AUTH_TOKEN="your_api_key"' >> ~/.bash_profile
source ~/.bash_profileMethod 4: Config File (Recommended)
Edit the config file vim ~/.claude/settings.json:
json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "Replace with your API Key",
"ANTHROPIC_BASE_URL": "https://anyapi.pro",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
},
"permissions": {
"allow": [],
"deny": []
}
}Verify Environment Variables
bash
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_AUTH_TOKENStep 4: Start Using
bash
claudeUse in a specific project:
bash
cd ~/Projects/my-project
claudeCommon Issues
Security Block
- Open System Preferences > Privacy & Security
- Find the blocked app and click "Open Anyway"
npm Permission Error (EACCES)
bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
npm install -g @anthropic-ai/claude-code