๐ 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.comwith 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 |
ย
