OfficialAnthropic-compatibleAnthropic
Claude Code
Anthropic's official terminal agent.
Claude Code speaks the Anthropic Messages protocol. Use an Anthropic key directly, or point it at any Anthropic-compatible endpoint with two environment variables.
Setup steps
- 1
Install the CLI
Requires Node.js 18 or newer. Installs the global claude command.
bashnpm install -g @anthropic-ai/claude-code - 2
Option A: use your Anthropic key
Set your key from the Anthropic Console. Windows keeps it across sessions; reopen the terminal after setx.
bash / zshexport ANTHROPIC_API_KEY="your-api-key"PowerShellsetx ANTHROPIC_API_KEY "your-api-key" - 3
Option B: use a custom endpoint
Route every request to a cheaper Anthropic-compatible gateway. Replace the URL and key with your provider's values.
bash / zshexport ANTHROPIC_BASE_URL="https://api.example.com" export ANTHROPIC_AUTH_TOKEN="your-api-key" - 4
Make it permanent
Instead of exporting each time, save the endpoint and key in the settings file so every session picks them up.
~/.claude/settings.json{ "env": { "ANTHROPIC_BASE_URL": "https://api.example.com", "ANTHROPIC_AUTH_TOKEN": "your-api-key" } } - 5
Start coding
Run it inside your project folder. It reads and edits files right where you are.
bashclaude
Tip: A base URL that is not api.anthropic.com is treated as a third-party gateway. Use ANTHROPIC_AUTH_TOKEN for gateways that expect a bearer token.
Pick a cheaper model or provider first, then plug its key and endpoint into the steps above. Compare prices · Browse providers