Open AI Sharing Platform
Comprehensive tutorials for Claude Code and Codex CLI configuration.
Tutorial for configuring Claude Code and Codex CLI on Windows.
Ensure Node.js is installed (v18+ recommended):
# Check Node.js version
node --version
# If missing, download from: https://nodejs.org/
# Install globally via npm
npm install -g @anthropic-ai/claude-code
# Install globally via npm
npm install -g @openai/codex
Open PowerShell or Command Prompt:
# Set API Base URL (your proxy address)
set ANTHROPIC_BASE_URL=https://your-api-proxy.com
# Set API Key (your key)
set ANTHROPIC_API_KEY=sk-your-api-key-here
# Start Claude Code
claude
Variable Name: ANTHROPIC_BASE_URL
Variable Value: https://your-api-proxy.com
Variable Name: ANTHROPIC_API_KEY
Variable Value: sk-your-api-key-here
# Set OpenAI API Base URL
set OPENAI_BASE_URL=https://your-api-proxy.com/v1
# Set API Key
set OPENAI_API_KEY=sk-your-api-key-here
# Start Codex
codex
# Test Claude Code
claude --version
claude "Hello, this is a test"
# Test Codex
codex --version
codex "Write a hello world in Python"
Tutorial for configuring Claude Code and Codex CLI on macOS.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install via Homebrew
brew install node
# Verify installation
node --version
npm --version
# Install Claude Code
npm install -g @anthropic-ai/claude-code
# Install Codex
npm install -g @openai/codex
# Set API Base URL
export ANTHROPIC_BASE_URL="https://your-api-proxy.com"
# Set API Key
export ANTHROPIC_API_KEY="sk-your-api-key-here"
# Start Claude Code
claude
Edit your shell profile:
# If using zsh (macOS default)
nano ~/.zshrc
# If using bash
nano ~/.bash_profile
Append the following:
# Claude Code API Config
export ANTHROPIC_BASE_URL="https://your-api-proxy.com"
export ANTHROPIC_API_KEY="sk-your-api-key-here"
# Codex API Config
export OPENAI_BASE_URL="https://your-api-proxy.com/v1"
export OPENAI_API_KEY="sk-your-api-key-here"
Save and reload configuration:
# Reload configuration
source ~/.zshrc # 或 source ~/.bash_profile
# Check if env vars are set
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_API_KEY
# Test Claude Code
claude "Hello, this is a test"
# Test Codex
codex "Write a hello world in Python"
Tutorial for configuring Claude Code and Codex CLI on Linux.
Install latest Node.js via NodeSource:
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# CentOS/RHEL/Fedora
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo yum install -y nodejs
# Arch Linux
sudo pacman -S nodejs npm
# Verify installation
node --version
npm --version
# Install Claude Code
sudo npm install -g @anthropic-ai/claude-code
# Install Codex
sudo npm install -g @openai/codex
# Set env vars and start
export ANTHROPIC_BASE_URL="https://your-api-proxy.com"
export ANTHROPIC_API_KEY="sk-your-api-key-here"
claude
Edit your shell profile:
# Use your preferred editor
vim ~/.bashrc
# OR
nano ~/.bashrc
Append the following:
# ===== API Config =====
# Claude Code API Config
export ANTHROPIC_BASE_URL="https://your-api-proxy.com"
export ANTHROPIC_API_KEY="sk-your-api-key-here"
# Codex API Config
export OPENAI_BASE_URL="https://your-api-proxy.com/v1"
export OPENAI_API_KEY="sk-your-api-key-here"
Save and reload configuration:
source ~/.bashrc
# Create/Edit env file
mkdir -p ~/.config/environment.d
nano ~/.config/environment.d/api.conf
Append the following:
ANTHROPIC_BASE_URL=https://your-api-proxy.com
ANTHROPIC_API_KEY=sk-your-api-key-here
OPENAI_BASE_URL=https://your-api-proxy.com/v1
OPENAI_API_KEY=sk-your-api-key-here
# Verify environment variables
env | grep -E "(ANTHROPIC|OPENAI)"
# Test Claude Code
claude --version
claude "Hello, this is a test"
# Test Codex
codex --version
codex "Write a hello world in Python"
# Check network connection
curl -I https://your-api-proxy.com/v1
# Check DNS resolution
nslookup your-api-proxy.com
# If using a proxy
export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890
| Tool | Env Variable | Description |
|---|---|---|
| Claude Code | ANTHROPIC_BASE_URL | API Base URL |
| Claude Code | ANTHROPIC_API_KEY | API Key |
| Codex | OPENAI_BASE_URL | API Base URL |
| Codex | OPENAI_API_KEY | API Key |