Routerly
Self-hosted LLM gateway with 11 routing policies and no database.
Replaces Portkey, Helicone, Bifrost, Kong Ai Gateway

Who it's for
Routerly's project isolation model assigns each tenant a router token with its own model list and monthly spend cap. The gateway enforces the cap before any request reaches a provider, so a single over-spending tenant cannot affect others. No application code changes are needed to onboard a new tenant.
If your tenants need dedicated server isolation rather than token-level isolation, running a separate Routerly instance per tenant may be more appropriate than sharing one deployment.
Routing your app through Routerly means model changes happen in the dashboard, not in code. The A/B testing feature splits live traffic between two router configurations, so you can compare a cheaper model against the current one on real production requests and see cost, latency, and error rate side by side before committing.
If you use a single provider and have no plans to change models, running a gateway adds latency and infrastructure overhead with no benefit.
Routerly accepts connections from any tool that speaks the OpenAI or Anthropic format. Configure Cursor, Open WebUI, LibreChat, or LangChain to point at Routerly instead of the provider directly, then apply guardrails, budget caps, and PII scrubbing at the gateway level for the whole team from one dashboard.
If your AI tools are SaaS-hosted and cannot be configured to use a custom API endpoint, local gateway routing will not reach their traffic.
Routerly can register both local Ollama models and cloud models in a single router. The built-in `cheap` routing profile sends simple requests to the free local model and falls through to a cloud model for complex ones. The dashboard cost breakdown shows how much each routing decision saves compared to always using the cloud path.
If you only need local model access without routing to cloud providers, running Ollama directly is simpler and has no overhead.
The problem
Applications that integrate AI providers directly absorb every reliability and cost risk of that choice. When a provider's API degrades, the application degrades with it. Pricing changes land on the bill with no warning. And actual AI spend only surfaces on the monthly invoice, not in per-call data that could inform routing decisions. The harder challenge is cost optimization at the per-request level. Sending every request to the most capable model wastes spend on simple tasks; routing everything to the cheapest model hurts quality for complex ones. Most teams handle this with hand-written conditional logic that breaks every time a provider releases a new model, changes pricing, or adjusts their context limits.
How it works
Policy scoring runs on every request in parallel. The `cheapest` policy minimizes cost, `health` deprioritizes failing endpoints, `llm` calls a language model to pick the best candidate for the specific prompt, and `semantic-intent` classifies the request with embeddings. Any combination of policies stacks into one ranking per request, and a failed call automatically falls through to the next candidate.
Routerly implements the OpenAI (`/v1/chat/completions`, `/v1/responses`) and Anthropic (`/v1/messages`) wire formats with full streaming. Switching an existing application means changing one URL: no SDK changes, no code changes. AI tools and frameworks that speak either protocol, including Cursor, LangChain, Open WebUI, and the Anthropic SDK, connect by pointing at the Routerly address.
Every request is priced per token using built-in presets for GPT-4o, Claude, and Gemini, with custom pricing available for any model. Hard spend caps at the router or global level block over-budget requests before they reach the provider, with limits configurable per hour, day, week, or month.
Configuration lives in plain JSON files under `~/.routerly/`, with no Postgres, no Redis, and no migration steps. The gateway stores API keys encrypted and router tokens as SHA-256 hashes; a Docker volume holds the data directory. A single `docker run` command produces a fully operational gateway with no external services to provision.
Each project gets a separate bearer token with its own model list, routing configuration, and budget limits. One instance of Routerly can serve multiple teams or tenants; there is no cross-project request or budget visibility. Per-project budget caps enforce spending at the router level before any call leaves your infrastructure.
Eight token optimizers reduce prompt size before each call. `session-dedup` removes duplicate context from long sessions, `ccr` compresses redundant content, and `llmlingua-2` applies learned compression. Each optimizer is off by default and enabled per router, so you can run them on high-volume routes without affecting others.
Features
- 11 Composable Routing Policies
- Drop-in Compatibility with OpenAI and Anthropic Formats
- Budget Enforcement and Per-Token Cost Tracking
- No Database Required
- Multi-Tenant Project Isolation
- 8 Opt-in Token Optimizers
How to install
Self-host Routerly on Docker with a persistent data volume.
docker run -d \
--name routerly \
-p 3000:3000 \
-v routerly_data:/data \
-e ROUTERLY_HOME=/data \
--restart unless-stopped \
inebrio/routerly:v0.5.3Recommended for this setup
Strengths
- LLM-Powered Routing: The `llm` and `semantic-intent` routing policies are unique among self-hosted gateways. Among the gateways in Routerly's README comparison table (LiteLLM, Bifrost, Portkey's OSS gateway), only Routerly documents an AI-powered routing policy that adapts decisions to the content of each request at runtime, accounting for prompt complexity and task type rather than just cost and latency signals.
- No Infrastructure Dependencies Beyond Docker: Most LLM proxy setups require Postgres for spend tracking and Redis for caching or rate limiting. Routerly stores everything in JSON files, which means a single `docker run` command produces a fully operational gateway with per-token billing, budget enforcement, and a web dashboard. No database to provision, no migration to run.
- Native Anthropic Messages API Format: Routerly serves native Anthropic Messages API requests at `/v1/messages`, not through a translation layer. The Python and Node.js Anthropic SDKs connect by changing `base_url`; full streaming and tool_use responses are supported. This matters for teams using tools built on the Anthropic SDK, including Claude Code and OpenClaw, that cannot easily switch to the OpenAI format.
- Transparent Per-Decision Routing Traces: Every routing decision records the policy scores that led to the choice and the model selected. The dashboard Playground lets you replay a request and inspect the full trace: which policies ran, what each scored, and which model won. This makes it straightforward to debug routing behavior and tune policy weights without reading logs.
Trade-offs
- AGPL-3.0 License Restricts Hosted Resale: You can run Routerly for yourself, your team, or your clients on your own servers at no cost. If you modify the source and offer Routerly as a hosted service to others (a managed or cloud service), AGPL-3.0 requires publishing your modifications. Teams running it privately or as internal infrastructure are unaffected; this restriction only applies to reselling managed access to others.
- SSO Not Yet Available: Dashboard access uses local user accounts. OAuth 2.0, OIDC, and LDAP login are on the roadmap but not shipped as of v0.5.3. Teams whose security policies require SSO for new services will need to manage accounts manually or wait for that feature before deploying organization-wide.
- Early-Stage Project with a Growing Ecosystem: Routerly has 107 GitHub stars and 9 open issues as of November 2026. It is actively maintained (last push November 4, 2026) and ships a substantial feature set, but as a newer project it has a smaller ecosystem of community guides and third-party integrations compared to LiteLLM. API stability, documented upgrade paths, and production war stories are still accumulating.
Tech stack
FAQ
Yes. Routerly is AGPL-3.0 licensed and free to run on your own infrastructure. There is no paid tier or usage fee for self-hosting. If you modify the source and offer Routerly as a hosted service to others, AGPL-3.0 requires publishing those modifications; running it for yourself or your team, including commercially, has no such requirement.
Yes. Routerly serves the Anthropic Messages API at `/v1/messages`, so the Python and Node.js Anthropic SDKs connect by changing `base_url` to the Routerly address. Full streaming and tool_use responses are supported. AI tools built on the Anthropic protocol, including Claude Code and OpenClaw, work by pointing their custom endpoint setting at the same address.
When a provider returns an error or times out, Routerly falls back to the next highest-scoring candidate model automatically. The `health` routing policy deprioritizes endpoints with recent errors, so a degraded provider is routed around on subsequent requests without manual intervention. Registering the same capability across multiple providers (OpenAI, Anthropic, Gemini) gives Routerly candidates to route to when one is down.
Configuration and usage data live in JSON files in the `~/.routerly/` directory (or the Docker volume mounted at `/data`). API keys are stored encrypted; router tokens are stored as SHA-256 hashes; passwords use bcrypt. No data leaves your server unless you configure a notification channel like Slack or a webhook.
Yes, when enabled, the `llm` policy makes an additional AI call to pick the model, adding the time of that call to each request. Teams sensitive to latency can disable it and use deterministic policies like `cheapest`, `health`, or `capability` instead. These run in-process with millisecond overhead. The `llm` policy is off by default and opt-in per router.