Phoebis Router¶
Phoebis Router relays Claude Code's requests to Anthropic under the credentials of an account it holds, and picks that account from a pool: a session sticks to one account, a rate limit fails over to a sibling, prompt caches are kept warm, and every request lands in a ledger the web console reads. Phoebis is a genus of sulphur butterflies, migrants of the Americas that land on the right flower. If you are setting a router up for the first time, start with the Quick start. The rest of this page is the listeners, the path a request takes through them, the words the other pages use, what the router does not do and where each page fits.
A note on the terms. Phoebis Router switches between Claude accounts that you personally own and pay for. Each account's limits stay enforced by Anthropic, and switching accounts to work past a limit is a gray area under Anthropic's consumer terms, so you run the router at your own risk. The terms forbid sharing an account's login or credentials with anyone else, reselling access and bypassing Anthropic's protective measures, and they say nothing about one person who holds several subscriptions. Do not back a shared or commercial service with consumer subscriptions. On its own side the router never presents an SDK client as the CLI, and an OAuth account refuses a request that names no user.
The listeners¶
One phoebis process serves three listeners, and a fourth where the bootstrap file holds the features block.
| Listener | Bootstrap key | Serves |
|---|---|---|
| Proxy | proxy.listen |
/v1/messages and its companions, the key's own usage page, plus the events route |
| Admin | admin.listen |
The console and /admin/* (see API reference) |
| Metrics | stats.metrics_listen |
/metrics in Prometheus text format, no credential, plain HTTP |
| Feature | features.listen, optional |
The calls of Artifacts and the claude.ai connectors, which Claude Code sends to two fixed hosts (see claude.ai features) |
The proxy and the admin listener terminate TLS natively or run plain HTTP by their tls key. The metrics listener is
plain HTTP, and the feature listener terminates TLS under a CA of the router's own (TLS on the
listeners).
The proxy listener answers HEAD /api/hello, HEAD and GET /api/ready, POST /v1/messages,
POST /v1/messages/count_tokens, GET /v1/usage, GET /v1/models, GET /v1/models/{*id} and
POST /v0/companion/events, and on a router with the features block GET /v0/features/ca.pem (What the proxy
accepts).
How a request travels¶
The client sends /v1/messages to the proxy listener with a key the router issued, in the credential header it would
have used for Anthropic. The router authenticates the key, resolves its pool, runs the pool's guardrails and then the
key's, refusing a request an enforcing guardrail matches before any account is touched (Guardrails),
and selects one account: the session's pin when it has one, otherwise the pool's strategy (Pools, keys and
routing). It puts the account's credential where the client put the key, edits the body and the headers as
The relay lists them, and sends the request in the client's own header order and spelling to
api.anthropic.com. The response head is classified before a byte reaches the client, so a 429 on one account fails
over to a sibling inside the same call. The request, each attempt and the usage land in the ledger.
The vocabulary¶
The console, the API, the bootstrap file and this site call what the router holds an account and a key the router issues
a key. The console and this site call the account kind whose credential is an Anthropic API key "API key". The API's
kind value is api_key. "Upstream" names the provider's host and the party that answered a request (the bootstrap
file's upstream block, the upstream_error outcome and the upstream_unreachable code, the upstream_message_id,
upstream_request_id and upstream_status fields, the phoebis_upstream_ttfb_seconds metric). The bootstrap file, the
one init writes, names two database files: the registry at storage.path and the ledger at stats.ledger_path. On
this site the client is Claude Code, and the plugin that reports to the router is the companion mod.
What the router does not do¶
- Claude Code's Remote Control is unavailable behind the router.
- No upstream other than Anthropic's API. The bootstrap file's
upstreamblock adds only a lab's trust anchor and resolver override, never another host.
Where to start¶
The Quick start is for the person with one machine who wants Claude Code answering through the router
on loopback. The client is for the person pointing Claude Code at the router and for the key holder.
Guardrails is for the operator blocking a request shape, the client's subagent summary fork first. Once
a loopback router works, A second machine covers a LAN host serving several machines.
Installation is for the operator installing on a host or in the container and for the one who needs
every setting. Pairing an account is for the operator adding an account in the console or by curl. An
operator tuning pools and keys, or reading why a request landed where it did, reads Pools, keys and
routing. Keepalive is for the operator turning cache warming on, and The companion
mod for the one installing and configuring the mod on a client machine. claude.ai
features is for the operator who wants Artifacts and the claude.ai connectors behind the router,
and for the user who starts the client through the launch script. The relay says what the router changes on
the wire and sends on its own. The console is for the operator reading or using a view.
Statistics is for the operator reading a figure's meaning or alerting on a gauge.
Operations is for the operator running the router for months. Development is for the
contributor. The API reference is for the operator scripting the admin API.
License¶
Phoebis Router is released under the MIT license. The text is in
LICENSE on GitHub and in the container image at
/usr/share/doc/phoebis/LICENSE.