OpenCodex

Claude Code CLI Configuration

Quick setup for terminal AI programming tool, supports all major models

Step 1: Enter API Key

Get your API Key from OpenCodex platform

Format: sk-live-xxxxxxxxxxxx

Step 2: Select Model

Choose the AI model that best fits your needs

Step 3: Set Environment Variables

# 添加到 ~/.bashrc 或 ~/.zshrc export ANTHROPIC_API_KEY="sk-live-your-api-key-here" export ANTHROPIC_BASE_URL="https://opencodex.hk/api/v1" export ANTHROPIC_MODEL="claude-3-5-sonnet"

Tip

Add the configuration above to ~/.bashrc or ~/.zshrc, then run source ~/.bashrc

Step 4: Install and Test

# 安装 Claude Code CLI npm install -g @anthropic-ai/claude-code # 测试连接 claude "你好,请用中文回答"

Usage Tips

claude "Help me refactor this code" - AI optimizes your code
claude "Explain what this function does" - AI explains code logic
claude "Generate unit tests" - AI automatically generates test cases