Tutorials
Claude Code
Configure a custom Claude-compatible root URL, token, and model for Claude Code.
Before you start
Your site name, docs domain, Claude-compatible root URL, model list, and token permissions all depend on your backend configuration.
For Claude Code, you usually need:
- A service root URL such as
https://api.example.com - A token such as
sk-your-token - A model exposed by your gateway
Install Claude Code
npm install -g @anthropic-ai/claude-codeThen confirm the command is available:
claude --versionTemporary environment variables
macOS / Linux
export ANTHROPIC_BASE_URL="https://api.example.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-token"
claudePowerShell
$env:ANTHROPIC_BASE_URL="https://api.example.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-your-token"
claudeSome environments may expect ANTHROPIC_API_KEY. If your local wrapper uses that variable name, keep it aligned with your setup.
Notes
- Claude Code commonly targets the Claude Messages-compatible path, usually
/v1/messages ANTHROPIC_BASE_URLshould normally be the service root, not the full/v1/messagespath- Model names depend on what your backend exposes
Troubleshooting
Authentication error
Check whether the token is valid and still allowed to call the model.
Model not found
The configured model name does not match the models exposed by your gateway.
404 from the gateway
This usually means the base URL was set to the wrong path.