How it works Features Docs Compare GitHub ↗
Self-host it Log in
Documentation

Get polyrouter running.

Self-host in a few minutes, mint an agent key, and point any OpenAI- or Anthropic-compatible SDK at your instance. Requires Docker with Compose v2.

Quickstart

One command checks Docker, fetches a pinned source archive, generates secrets into a mode-600 .env, and boots the stack. The first build takes a few minutes.

$ curl -fsSL https://polyrouter.app/install.sh | sh
# or from a checkout — uses your working tree, downloads nothing git clone https://github.com/izzoa/polyrouter.git cd polyrouter && ./install.sh
Note The app publishes on loopback only by default, and the first account to sign up becomes the admin — that happens at sign-up, before the setup guide runs, not as a step inside it. Sign up at http://localhost:3001 before exposing anything.
localhost:3000
Setup guide
three steps to your first routed request
Agent 2 Provider 3 Routing
Connect an agent
key poly_… — shown once
2
Connect a provider
in progress
3
Verify routing
a real model:"auto" request
Name
Anthropic
API key
Subscription
Custom endpoint
Local
Protocol
Anthropic-compatible
Base URL
https://api.anthropic.com
Credential · encrypted at rest
sk-ant-••••••••••••••••
Connect provider & sync models
Synced — claude-sonnet-5 assigned to the default tier.

Connect an agent

Create a key in the dashboard (Agents → New — shown once), then point your client at your instance. Any tool that lets you set a base URL and API key works with no other changes.

OpenAI SDK
https://<your-instance>/v1
Anthropic SDK
https://<your-instance>
API key
Authorization: Bearer poly_…
OPENAI-COMPATIBLE
curl https://you/v1/chat/completions \ -H "Authorization: Bearer poly_…" \ -H "Content-Type: application/json" \ -d '{"model":"auto", "messages":[{"role":"user", "content":"hi"}]}'
ANTHROPIC-COMPATIBLE
curl https://you/v1/messages \ -H "Authorization: Bearer poly_…" \ -H "Content-Type: application/json" \ -d '{"model":"claude-sonnet-5", "max_tokens":256, "messages":[{"role":"user", "content":"hi"}]}'
Tip Pin a routing tier instead of a model by sending x-polyrouter-tier: fast with "model":"auto".

Harnesses: OpenClaw, Hermes & coding agents

Any coding harness or agent works — it's just a base URL and a poly_ key. polyrouter is built for them: the L1 structural router excludes the harness system preamble from its features, so a huge OpenClaw or Hermes system prompt can't skew model:"auto" toward the top tier.

OPENCLAW · ~/.openclaw/config.toml
# ~/.openclaw/config.toml [llm] base_url = "https://<your-instance>/v1" api_key = "poly_…" model = "auto"
HERMES · ~/.hermes/config.yaml
# ~/.hermes/config.yaml model: default: auto provider: custom base_url: "https://<your-instance>/v1" api_key: "poly_…"
Prefer secrets out of the YAML? Set api_key: ${POLYROUTER_KEY} and put POLYROUTER_KEY=poly_… in ~/.hermes/.env.
OTHER HARNESSES · OpenAI-compatible
# any tool that reads an OpenAI base URL export OPENAI_BASE_URL="https://<your-instance>/v1" export OPENAI_API_KEY="poly_…" # then run with model: auto
Tip When you mint the key, pick OpenClaw or Hermes as the platform to get its native config block; choose cURL / other for anything not listed — the connection is identical.
Why harnesses route correctly here
Harnesses send large, repetitive system preambles. Rule-based routers read those and push everything into the top tier — the failure that led other gateways to drop automatic routing. polyrouter fingerprints and subtracts the preamble in L1, so auto reflects the actual task, not the boilerplate. See the comparison →

Explore the docs

Six focused guides for going deeper — how routing decides, how providers connect, the wire API, the security posture, every config knob, and day-two operations.

View on GitHub ↗ Explore features →