Due to Claude Code’s multi-agent nature, quota consumption can be quite significant. It’s recommended to set limited quotas for your Key to prevent billing surprises.

Quick Configuration Guide

1️⃣ Global npm Package Installation

Run in terminal:
npm install -g @aihubmix/claude-code
Replace sk-*** with your API key generated on AiHubMix. Configuration items other than models will be processed with system environment variables taking priority.
export AIHUBMIX_API_KEY="sk-***"
export HOST="127.0.0.1"  # Optional
export PORT="3456"        # Optional
export LOG="true"         # Optional
export API_TIMEOUT_MS="30000"  # Optional
  • For Mac users, you can navigate to your username directory and press ⌘ + ⇧ + . to show the hidden .zshrc file, then open it with the system’s “TextEdit” app and add the above content.
  • After adding the configuration, run source ~/.zshrc in terminal and press enter to make the configuration effective.

3️⃣ Generate Configuration File

Replace sk-*** below with your AiHubMix API key, then run this one-liner in terminal:
mkdir -p ~/.aihubmix-claude-code && cat > ~/.aihubmix-claude-code/config.json <<EOF
{
  "API_KEY": "sk-***",
  "HOST": "127.0.0.1",
  "PORT": 3456,
  "LOG": true,
  "API_TIMEOUT_MS": 30000,
  "Router": {
    "default": "claude-sonnet-4-20250514",
    "background": "claude-3-5-haiku-20241022",
    "think": "claude-sonnet-4-20250514",
    "longContext": "gpt-4.1",
    "longContextThreshold": 60000,
    "webSearch": "gemini-2.0-flash-search"
  }
}
EOF

4️⃣ Usage

acc start

More Resources