Claude subscription
Route your Claude Pro or Max plan through BitRouter — OAuth, no Anthropic API key, no per-token bill.
Already paying for Claude Pro or Max? Use that plan as a model source. bitrouter providers login claude-code adopts the live Claude Code session, stores a refreshing credential, and attaches it to requests routed to the claude-code provider — so your subscription's usage covers the tokens and there's no ANTHROPIC_API_KEY to manage.
Subscription, not API key. This is the OAuth path — it bills against your Claude plan. If you'd rather pay per token with an Anthropic API key, skip the login and set ANTHROPIC_API_KEY in the environment instead; the separate anthropic provider picks it up automatically.
Log in
bitrouter providers login claude-codeThis reuses your local Claude Code session when one is available, and drives Claude Code's own login flow if needed. The credential is stored under $XDG_DATA_HOME/bitrouter/oauth-tokens.json and auto-refreshes — you log in once. To remove it later:
bitrouter providers logout claude-code # remove the stored credentialOne auth mode per request. A request routed to claude-code:<model> uses your OAuth subscription; a request routed to the anthropic provider uses ANTHROPIC_API_KEY. Run bitrouter providers logout claude-code to remove the subscription route.
Multiple accounts
Each credential is keyed by (provider, label). Pass --label to keep more than one Claude account side by side:
bitrouter providers login claude-code --label work
bitrouter providers login claude-code --label personalRoute to it
No bitrouter.yaml block is required — the claude-code provider is enabled automatically when the stored credential exists. Address Claude models through the explicit subscription provider route:
bitrouter route claude-code:claude-sonnet-4-6Then start BitRouter and send a request. Use the explicit id claude-code:claude-sonnet-4-6 to pin the request to your subscription, or use the Claude Code harness flow below so BitRouter detects genuine Claude Code traffic and rewrites bare Claude model names to the subscription provider.
Run Claude Code through BitRouter (with telemetry)
Use BitRouter as a transparent harness for the Claude Code CLI — with BitRouter in the path purely for side-effects: observability today, optional model rerouting tomorrow. From a freshly-installed bitrouter:
1. Adopt your existing Claude Code session as the claude-code subscription provider (drives the claude CLI's own login if you're not signed in yet):
bitrouter providers login claude-code2. Turn on full first-party telemetry (off by default) — create ~/.bitrouter/bitrouter.yaml:
server:
skip_auth: true # local daemon: admit credential-less spawn traffic
plugins:
bitrouter-observe:
telemetry:
enabled: true # nothing is exported unless you opt in
level: full # metadata + request/response content (use `metadata` to omit content)
# endpoint omitted → defaults to https://telemetry.bitrouter.ai3. Start the daemon in the background and verify it's up:
bitrouter start # detached; logs to ~/.bitrouter/bitrouter.log
bitrouter status # running: yes — listen 127.0.0.1:4356
bitrouter observe status # telemetry exporter endpoint + state4. Launch an interactive Claude Code session pointed at BitRouter:
bitrouter launch -a claude # interactive; run `bitrouter stop` when you're doneGenuine Claude Code traffic — recognised by its anthropic-beta: claude-code-* agent-profile marker — is routed to your subscription; anything else falls through to your other configured providers. Telemetry is attributed to an anonymous install id. (Optional: run bitrouter cloud login first to also serve non-Claude-Code models from your BitRouter Cloud account.)
Learn more
- Claude Code — point the Claude Code CLI at BitRouter (a harness), distinct from using your plan as a model source above.
- Models — the full
provider/modelid scheme. - Model fallback — fail over from your subscription to a hosted model on overload.
How is this guide?