Point your agents at one URL with one key. polyrouter routes each request to the right model across your providers — explicit-first, with fallbacks, hard spend limits, and honest cost tracking. Your keys, your box, zero markup.
Precedence is dead simple — first match wins. Whatever decides, your budgets and cost recording still apply, and anything that resolves to a tier also gets that tier's ordered fallback chain. All five phases →
Filter by how a request was routed, or by fallback and escalation — then open any row: the inspector shows the routing reason verbatim, the workload class the router recorded, tokens, snapshot-priced cost, and latency.
Requires Docker with Compose v2. The first account you create becomes the admin.
curl -fsSL
https://polyrouter.app/install.sh | sh
Agents → New agent
poly_9f2cKq3… # shown once
curl https://you/v1/chat/completions \
-H "Authorization: Bearer poly_…" \
-H "Content-Type: application/json" \
-d '{"model":"auto",
"messages":[…]}'
Two open-source gateways making different bets on routing — plus a closed hosted proxy for contrast.
| polyrouter | Manifest | Hosted proxy | |
|---|---|---|---|
| Automatic routing | Smart auto — L1 structural by default, opt-in L2 semantic + L3 cascade, per-workload targets, degrades safely | Custom tiers · rule-based retired | Varies |
| Harness system prompts | Fingerprinted & subtracted | Prompted the move to custom tiers | — |
| Tier pinning | x-polyrouter-tier | x-manifest-tier | Varies |
| Prompt & response data | Metadata only by default | Configurable | Often logged |
| Where it runs | Self-host · one container | Self-host or managed Cloud | Managed cloud |
| Cost | Free & open source · BYOK | Free & open source · paid Cloud | Per-token margin |
| Lock-in | Low · AGPL-3.0 | Low · open source | Higher · proprietary |
By default, no — only metadata (tokens, cost, latency, routing decision) is recorded; prompt and response bodies stay out of the database. Self-hosted instances can optionally enable body capture: encrypted at rest, off by default, behind an explicit consent gate, retention-bounded, and self-host only — cloud instances never capture.
Any OpenAI- or Anthropic-compatible endpoint: BYOK API keys, custom endpoints, and local models. You can also connect a Claude Pro/Max or ChatGPT Plus/Pro subscription over OAuth instead of paying per token. Cross-protocol requests are translated automatically.
Yes — connect a Claude Pro/Max or ChatGPT Plus/Pro subscription through a guided OAuth wizard instead of pasting a token. Access and refresh tokens are stored encrypted at rest and auto-refresh safely across requests and instances; if a grant is revoked, a one-click Reauthorize reconnects it while your fallback chain keeps serving. One caveat: using flat-rate consumer subscriptions programmatically may violate the provider's ToS, so pair one with a pay-per-token fallback (the dashboard surfaces this). Subscription routing →
Explicit routing comes first — a named model or tier always wins. For model:"auto" it runs L1 structural by default (sub-millisecond local features — the harness system prompt is excluded from scoring and the agent's own rolling size baseline is subtracted). L1 also records a workload class — what kind of work the request is: code, vision or structured in the baseline, never by keyword. Bind a class to a tier or model and that Workload target claims the request before the bands, L2 and the cascade; you can also scope an auto_high / auto_low band to one class. Two more layers are opt-in via ROUTING_AUTO_LAYERS: L2 semantic (a local embedding that refines only what L1 finds ambiguous — needs the -semantic image, and the same opt-in adds the research and writing classes) and L3 cascade (try the cheap tier, escalate on a failed quality check — inside a class when the band is scoped). A disabled, skipped or faulted layer never fails the request: the decision falls through to the next enabled layer, and to your default tier when none is left. Every decision is recorded in the inspector. How routing works →
One base URL and one poly_ key. Any SDK that accepts a base URL works unchanged — OpenAI clients use /v1, Anthropic clients hit the root. See the docs →
Self-host is available today. Polyrouter Cloud — the same router, fully managed — is coming soon. Join the waitlist →
AGPL-3.0. Run it, self-host it, fork it — if you offer a modified polyrouter as a network service, share your modified source.
Docker with Compose v2. One container serves the SPA, API and proxy next to PostgreSQL 16 + Redis; a prebuilt multi-arch image is available to skip the local build.