Integrating Claude Code
Anthropic's official CLI AI coding tool. It supports code generation, refactoring, debugging, and automated commits, and connects to Calgine Tokens via the Anthropic-compatible protocol.
Claude Code is a CLI AI coding assistant from Anthropic that lets you interact with your codebase in natural language and complete the full development workflow from requirements to commits.
Prerequisites
- Sign up at the Calgine Tokens Console.
- Go to Workspace → API Tokens, click "Add Token", and copy the API Key after creation (starts with
sk-).
| Setting | Value |
|---|---|
ANTHROPIC_BASE_URL | https://api.calgine.com.cn/anthropic |
ANTHROPIC_AUTH_TOKEN | The API token you created in the console |
Installation & Configuration
Install Node.js: make sure Node.js 18+ is installed:
bashnode -vInstall Claude Code:
bashnpm install -g @anthropic-ai/claude-codeSet environment variables (choose one):
bashecho 'export ANTHROPIC_AUTH_TOKEN="sk-your-token"' >> ~/.zshrc echo 'export ANTHROPIC_BASE_URL="https://api.calgine.com.cn/anthropic"' >> ~/.zshrc source ~/.zshrcbashecho 'export ANTHROPIC_AUTH_TOKEN="sk-your-token"' >> ~/.bashrc echo 'export ANTHROPIC_BASE_URL="https://api.calgine.com.cn/anthropic"' >> ~/.bashrc source ~/.bashrcpowershell[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-your-token", "User") [Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.calgine.com.cn/anthropic", "User")Alternatively, write them into Claude Code's config file
~/.claude/settings.json:json{ "env": { "ANTHROPIC_AUTH_TOKEN": "sk-your-token", "ANTHROPIC_BASE_URL": "https://api.calgine.com.cn/anthropic" } }Enter your project directory and launch:
bashcd your-project-folder claude
Verify the Setup
After launching claude, ask any question in the interactive prompt (e.g., "describe the current project structure"). A normal response means the integration works. You can also run /status to check the current Base URL and model.
Common Commands
| Command | Description |
|---|---|
claude | Start interactive mode |
claude "task description" | Run a one-off task |
claude commit | Generate a Git commit message and commit |
/help | List all available commands |
/clear | Clear the current conversation history |
/model | Switch the model in use |
Recommended Models
| Scenario | Recommended Model |
|---|---|
| Everyday coding assistance | claude-sonnet-4-5 |
| Complex tasks & deep refactoring | claude-opus-4-5-20251101 |
Note
Claude Code's agent mode calls the model frequently and consumes far more tokens than regular chat. Keep an eye on your quota and rate limits — see Rate Limits.
Next Steps
- Cline: Use the same Claude models inside VS Code
- Prompt Caching: Reduce costs in long-context scenarios