What it does
Polyrouter runs in one Docker container alongside PostgreSQL 16 and Redis, and it requires Docker with Compose v2. The container serves the web app, the API and the proxy. The first account created becomes the admin. In the console, users mint a poly_ agent key under Agents. Any OpenAI or Anthropic SDK that accepts a base URL works unchanged. OpenAI clients use /v1, and Anthropic clients use the root. Polyrouter routes each request with explicit-first precedence. When a request names a model, Polyrouter uses that model. Otherwise it applies header rules, workload targets, model "auto" smart layers or the default tier. Each tier has an ordered fallback chain that is tried in order until one responds. Providers can be bring-your-own-key API keys, custom endpoints or local models.
Capabilities
- Header rules pin a request to a tier with x-polyrouter-tier, or match custom headers using rules the user configures.
- Model "auto" uses a structural layer by default. Users can opt in to a semantic layer and to a cascade layer that tries the cheap tier first and escalates on a failed quality check.
- Day, week or month budgets can be global or per-agent, and they are enforced with atomic Redis counters across every instance.
- Polyrouter snapshots each request's unit prices at request time and records them with the cost.
- By default only metadata is stored. Encrypted prompt and response body capture is optional, off by default and available only when self-hosted.
When to use it
- Use it when agents need to reach several model providers through one URL and one key.
- Use it when requests need ordered fallbacks across several providers.
- Use it when spend needs hard day, week or month limits for all agents or for each agent.