Claude Code

Claude Code

Claude Code is a CLI tool that brings Claude's coding capabilities directly to your terminal. LivRouter supports Claude Code via the Anthropic API compatibility layer.

Setup

  1. Install Claude Code: npm install -g @anthropic-ai/claude-code
  2. Configure the environment variables to point to LivRouter:
bash
export ANTHROPIC_BASE_URL="https://api.livrouter.com"export ANTHROPIC_API_KEY="your-livrouter-api-key"

Do not add a /v1 suffix: Claude Code and the Anthropic SDK append /v1/messages themselves. After setting these variables, you can run claude in your project directory to start using it with LivRouter.

Verify the setup

Open a new terminal so the exported variables are loaded, run claude inside a project folder, and send a short prompt. If the setup is correct the reply comes back normally, and the request appears in your LivRouter usage logs together with the model that served it.

Models and spend

Claude Code sends Anthropic Messages API requests, so it runs on Claude model IDs from your catalog. Each Claude model page — for example the Claude family listing — shows the exact current IDs and per-plan rates. Usage is billed from prepaid credits like every other LivRouter request; nothing about the API key or endpoint changes.

Troubleshooting

  • 404 on every request — the base URL carries a /v1 suffix. Use https://api.livrouter.com exactly as shown above.
  • 401 or invalid API key — the key must be a LivRouter key created on the API keys page, not an Anthropic account key.
  • Variables disappear between sessions — export applies to the current shell only. Add both lines to your shell profile (~/.bashrc, ~/.zshrc) to persist them, or use setx on Windows.

For SDK-level behavior — streaming, tool use, retries — see the Anthropic SDK guide.