Skip to main content
Claude Code is Anthropic’s official CLI for Claude. RouterLink exposes an Anthropic-compatible endpoint, so you can route Claude Code through RouterLink and pay with credits instead of an Anthropic subscription.
  • Pay-as-you-go — bill against your RouterLink credit balance, no monthly subscription.
  • Per-key budgets — hard-cap monthly spend on the key Claude Code uses.
  • Unified billing — Claude Code usage shows up in the same dashboard as the rest of your traffic.
  • Files API supported — upload, fetch, and delete files via Claude Code’s tool use loop.

Setup

1

Get a RouterLink API key

Follow the Quickstart if you don’t have one yet.
2

Install Claude Code

npm install -g @anthropic-ai/claude-code
Or follow the official install guide.
3

Point Claude Code at RouterLink

Set two environment variables before launching:
export ANTHROPIC_BASE_URL="https://router-link.world3.ai/api/anthropic"
export ANTHROPIC_API_KEY="<your-routerlink-key>"

claude
Add these to your shell profile (~/.zshrc, ~/.bashrc) so every Claude Code session uses RouterLink automatically.
4

Verify

Run claude and ask a quick question. Then check your RouterLink Dashboard — you should see the request appear within a few seconds, billed against your key.

What’s supported

FeatureStatus
/v1/messages (streaming + non-streaming) Supported
/v1/messages/count_tokens Supported
Tool use Supported
Prompt caching (cache_control) Supported
Extended thinking Supported
Files API (/v1/files) Supported
Batches API Coming soon
For the full compatibility matrix and edge cases, see the Integration Guide.

Switching models

Claude Code uses Sonnet by default. To switch model, use Claude Code’s /model slash command — RouterLink forwards whatever model you select to the upstream provider, so any Anthropic model name works (claude-sonnet-4-6, claude-opus-4-7, claude-haiku-4-5, …).

Troubleshooting

Check that ANTHROPIC_API_KEY is your RouterLink key (starts with rl-), not an Anthropic key. RouterLink does not accept upstream Anthropic keys.
The key Claude Code is using has hit its monthly budget cap. Raise the cap in API Keys → Edit or add credits in Billing → Recharge.
Make sure you’re on the latest Claude Code version. RouterLink ships streaming fixes for cross-vendor thinking that landed in v1.0+.