KozeKoze
← Back to Blog
Tutorial2026年3月23日·管理员

Claude Code Configuration Tutorial

Claude Code Configuration Tutorial

📋 Preparatory Steps

Before you begin, please ensure you have:

  • Registered a Koze account and logged in
  • Created an API Key on the API Management page
  • Installed Claude Code (npm install -g @anthropic-ai/claude-code)

🚀 Step 1: Setting Environment Variables

Execute the following commands in the terminal to set the API address and key as environment variables:

# Set the Koze proxy address to the Base URL
export ANTHROPIC_BASE_URL='https://api.kozeai.com/v1'

# Set the API Key you created in the Koze backend
export ANTHROPIC_AUTH_TOKEN="Your API Key"

💡 Tip: Replace https://api.kozeai.com with your actual service domain. API keys can be viewed or created on the "API Management → Existing Keys" page.

🔧 Step Two: VSCode Plugin Configuration (Optional)

If you are using the Claude plugin for VSCode, you need to configure it in `~/.claude/config.json`:

{

"primaryApiKey": "Your API key",

"apiBaseUrl": "https://api.kozeai.com/v1"

}

If the file does not exist, please create it manually.

  • macOS / Linux: ~/.claude/config.json
  • Windows: C:\Users\Your Username\.claude\config.json

🎯 Step 3: Launch Claude Code

After configuring the environment variables, launch it directly in the terminal:

claude

Claude Code will automatically use the Koze proxy address you configured to make requests.

📌 Persistent Environment Variables

To avoid resetting the variables every time you open the terminal, it is recommended to write the variables to the shell configuration file:

# Bash User

echo 'export ANTHROPIC_BASE_URL='https://api.kozeai.com/v1' >>> ~/.bashrc

echo 'export ANTHROPIC_AUTH_TOKEN='your API key' >>> ~/.bashrc

source ~/.bashrc

# Zsh User

echo 'export ANTHROPIC_BASE_URL='https://api.kozeai.com/v1' >>> ~/.zshrc

echo 'export ANTHROPIC_AUTH_TOKEN='your API key' >> ~/.zshrc

source ~/.zshrc

✅ Verify Connection

After starting Claude Code, if you see a normal dialog interface, the configuration is successful. You can view real-time call records on Koze's "Usage Statistics" page.

⚠️ Frequently Asked Questions

Problem Solution
Tip: Invalid API Key Check if the API Key was copied correctly, ensuring there are no extra spaces
Connection Timeout Confirm if the Base URL is correct and contains the suffix /v1
Model Unavailable Check the list of available models for the current package in the Koze Model Lobby

 

#claude#code#claude code
Claude Code Configuration Tutorial | Koze AI