Configure Claude Code

Set two environment variables to route all Claude Code requests through Chuizi.AI with native Anthropic protocol passthrough.

VariableValuePurpose
ANTHROPIC_BASE_URLhttps://api.chuizi.ai/anthropicAPI endpoint URL
ANTHROPIC_API_KEYck-your-key-hereYour Chuizi.AI API key

Make sure to use the /anthropic path. This is the native Anthropic protocol endpoint with zero format conversion, giving you the best performance and full compatibility with all Claude Code features including streaming, tool use, and prompt caching.

Add the environment variables to your shell profile so they're set automatically every time you open a terminal.

zsh users (macOS default):

terminal
bash
echo 'export ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY=ck-your-key-here' >> ~/.zshrc
source ~/.zshrc

bash users (most Linux distributions):

terminal
bash
echo 'export ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic' >> ~/.bashrc
echo 'export ANTHROPIC_API_KEY=ck-your-key-here' >> ~/.bashrc
source ~/.bashrc

Once configured, just run:

terminal
bash
claude

Method 2: Inline Environment Variables

Use this for quick testing or when you don't want to modify your global configuration:

terminal
bash
ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic \
ANTHROPIC_API_KEY=ck-your-key-here \
claude

You need to include both variables every time you launch Claude Code.

Method 3: Per-Project .env File

Claude Code reads configuration from a .env file in the project root directory. This is useful for teams where different projects use different API keys.

Create a .env file in your project root:

terminal
bash
# .env
ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic
ANTHROPIC_API_KEY=ck-your-key-here

Then run claude from that directory.

Make sure to add .env to your .gitignore to prevent key leakage:

terminal
bash
echo '.env' >> .gitignore

Verify Your Configuration

After configuring, follow these steps to confirm everything works:

Step 1: Launch Claude Code

terminal
bash
claude

Step 2: Send a test message

> Describe yourself in one sentence

Step 3: Check the dashboard

Log in to app.chuizi.ai and go to the Request Logs page. You should see the request you just made, including the model used, token counts, and cost.

Important Notes

Use /anthropic, Not /v1

Chuizi.AI provides two API protocols:

  • /anthropic — Native Anthropic protocol. Claude Code must use this.
  • /v1 — OpenAI-compatible protocol, used by Cursor, LangChain, and similar tools.

Claude Code sends requests in Anthropic Messages API format. If you mistakenly set the /v1 endpoint, requests will fail due to format mismatch.

Key Security

  • Never commit API keys to a Git repository
  • Never share keys in documents or chat messages
  • If a key is compromised, delete it immediately in the dashboard and create a new one
  • Consider creating separate keys for different purposes (e.g., "claude-code-work", "claude-code-personal")

Managing Multiple Keys

If you have multiple Chuizi.AI keys for separate billing (personal vs. company projects), use Method 3 with per-project .env files.

Next Steps

Configure Claude Code — Chuizi AI Docs | Chuizi AI