TokenFleet
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:

  1. A service root URL such as https://api.example.com
  2. A token such as sk-your-token
  3. A model exposed by your gateway

Install Claude Code

npm install -g @anthropic-ai/claude-code

Then confirm the command is available:

claude --version

Temporary environment variables

macOS / Linux

export ANTHROPIC_BASE_URL="https://api.example.com"
export ANTHROPIC_AUTH_TOKEN="sk-your-token"
claude

PowerShell

$env:ANTHROPIC_BASE_URL="https://api.example.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-your-token"
claude

Some 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_URL should normally be the service root, not the full /v1/messages path
  • 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.