A self-hosted alternative to OpenRouter
When to move from OpenRouter to a self-hosted AI gateway, how Kaeso compares with OpenRouter, LiteLLM, Bifrost and Portkey, and how to keep OpenRouter as a fallback provider.
- Published
- Reading time
- 4 min
- Author
- Kaeso Team

OpenRouter is a hosted multi-model router: you create one account, buy credits, and call hundreds of models from OpenAI, Anthropic, Google and open-weight hosts through a single OpenAI-compatible endpoint. That removes server operations entirely, which is why it is popular for prototypes and solo projects.
Teams look for a self-hosted alternative to OpenRouter when three constraints show up in production: provider API keys and prompt traffic must stay inside their own infrastructure, local models such as Ollama or vLLM need to sit behind the same API as cloud models, or per-team spend caps, SSO and audit logs need to be enforced directly without paying platform credit markups.
Good self-hosted alternatives to OpenRouter01
Four mature open-source gateways cover the self-hosted use case, each with a different architecture:
- Kaeso (Rust, MIT): self-hosted only, single Rust gateway binary with PostgreSQL, Valkey and optional ClickHouse. Speaks five native SDK formats (OpenAI Chat Completions and Responses, Anthropic Messages, Google Gemini API and ElevenLabs), includes 50 built-in providers plus local custom providers (Ollama, vLLM, LM Studio, llama.cpp), hard Valkey spend budgets, alias fallback routes, a web console, an MCP portal, and OIDC SSO with SCIM 2.0 in the MIT code. Benchmarked at 6,338 req/s on two cores (/benchmarks).
- LiteLLM (Python, MIT core with commercial
enterprise/): widest provider catalogue (100+ providers) and extensive observability callbacks (Langfuse, Datadog, S3). Free SSO stops at five users, and Python proxy throughput is much lower under concurrency (74 req/s on the same two-core benchmark; an unreleased Rust rewrite reached 3,211 req/s). - Bifrost (Go, Apache 2.0): fast compiled Go gateway (2,806 req/s in our benchmark) with low setup friction, virtual keys, fallbacks and MCP routing; enterprise governance and SSO sit in commercial tiers.
- Portkey Gateway (TypeScript, MIT core): config-driven routing, guardrails and semantic caching (779 req/s in our benchmark), paired with a commercial cloud platform for full team dashboards and governance.
See the full feature and benchmark table on /compare.
OpenRouter vs Kaeso02
- Deployment
- OpenRouter
- Hosted multi-tenant SaaS
- Kaeso 0.7.0
- Self-hosted only (Docker Compose, Kubernetes Helm, Linux, cloud templates)
- Provider keys
- OpenRouter
- OpenRouter's keys (or BYOK hosted on OpenRouter)
- Kaeso 0.7.0
- Your own keys, AES-256-GCM encrypted on your server
- Billing & markup
- OpenRouter
- Unified OpenRouter credits and fee structure
- Kaeso 0.7.0
- Direct provider billing at your negotiated rates, zero gateway markup
- Prompt & usage logs
- OpenRouter
- Routed through OpenRouter infrastructure
- Kaeso 0.7.0
- Stored in your own PostgreSQL and optional ClickHouse; content logging can be turned off
- Local models
- OpenRouter
- Cloud providers only
- Kaeso 0.7.0
- Built-in custom provider support for Ollama, vLLM, LM Studio, llama.cpp
- Inbound APIs
- OpenRouter
- OpenAI Chat Completions compatible
- Kaeso 0.7.0
- OpenAI Chat & Responses, Anthropic Messages, Gemini API, ElevenLabs
- Coding tools
- OpenRouter
- OpenAI-compatible clients
- Kaeso 0.7.0
- Native Claude Code (
/v1/messages), Codex (/v1/responses), Cursor, Linear BYOK
- Budgets & limits
- OpenRouter
- Per-key credit caps on OpenRouter
- Kaeso 0.7.0
- Nested Project, Member/Service account and Key hard budgets in Valkey
- Team access
- OpenRouter
- Hosted accounts
- Kaeso 0.7.0
- Self-hosted OIDC SSO, SCIM 2.0, 2FA, custom RBAC roles and audit logs (MIT)
| Area | OpenRouter | Kaeso 0.7.0 |
|---|---|---|
| Deployment | Hosted multi-tenant SaaS | Self-hosted only (Docker Compose, Kubernetes Helm, Linux, cloud templates) |
| Provider keys | OpenRouter's keys (or BYOK hosted on OpenRouter) | Your own keys, AES-256-GCM encrypted on your server |
| Billing & markup | Unified OpenRouter credits and fee structure | Direct provider billing at your negotiated rates, zero gateway markup |
| Prompt & usage logs | Routed through OpenRouter infrastructure | Stored in your own PostgreSQL and optional ClickHouse; content logging can be turned off |
| Local models | Cloud providers only | Built-in custom provider support for Ollama, vLLM, LM Studio, llama.cpp |
| Inbound APIs | OpenAI Chat Completions compatible | OpenAI Chat & Responses, Anthropic Messages, Gemini API, ElevenLabs |
| Coding tools | OpenAI-compatible clients | Native Claude Code (/v1/messages), Codex (/v1/responses), Cursor, Linear BYOK |
| Budgets & limits | Per-key credit caps on OpenRouter | Nested Project, Member/Service account and Key hard budgets in Valkey |
| Team access | Hosted accounts | Self-hosted OIDC SSO, SCIM 2.0, 2FA, custom RBAC roles and audit logs (MIT) |
Keep OpenRouter as a provider while you migrate03
Switching off OpenRouter does not have to be all-or-nothing. OpenRouter is one of Kaeso's 50 built-in providers (supported providers).
Many teams start by adding their direct OpenAI, Anthropic and Google AI Studio keys to Kaeso alongside their existing OpenRouter key:
- 01Route primary production models (
claude-sonnet-5-5,gpt-6-sol,gpt-5.4-mini) directly to Anthropic and OpenAI with zero platform fee and direct enterprise data agreements. - 02Keep OpenRouter connected in Kaeso for experimental or long-tail open-weight models you do not want separate vendor accounts for yet.
- 03Add a local Ollama or vLLM server as a custom provider for private or zero-token-cost workloads.
- 04Put an alias route on top so a primary model falls back to another provider or to OpenRouter when rate-limited or unavailable (Retries and fallbacks).
Applications call one base URL (https://kaeso.example.com/v1 for OpenAI SDKs, https://kaeso.example.com for Anthropic and Google Gen AI SDKs) with a single Kaeso key (sk-kso-…). Every model across direct providers, OpenRouter and local servers shares the same budgets, rate limits, guardrails and request logs.
Switching an app from OpenRouter to Kaeso04
import os from openai import OpenAI client = OpenAI(- base_url="https://openrouter.ai/api/v1",- api_key=os.environ["OPENROUTER_API_KEY"],+ base_url="https://kaeso.example.com/v1",+ api_key=os.environ["KAESO_API_KEY"], )Kaeso also accepts provider/model identifiers (such as anthropic/claude-sonnet-5-5 or openrouter/…), so existing routing prefixes stay clear when several providers serve the same model ID. Model prices, context windows and capabilities stay up to date automatically through KPMR (opens in a new tab), Kaeso's signed model registry, or can be overridden per project.
When OpenRouter is still the better choice05
Stay on OpenRouter when you want zero infrastructure to maintain, a single consolidated invoice across dozens of small inference providers, or instant pay-as-you-go access to new models without signing direct provider agreements. Self-hosting Kaeso requires a Linux host (at least 2 vCPUs, 4 GB RAM and 20 GB disk) or a Kubernetes cluster and direct accounts with the model providers you call.
For deployment options from a single Hetzner or DigitalOcean VM to Kubernetes, see Where to run Kaeso. For how Kaeso keeps keys and logs under your control, read Request logs and privacy.
Product names in this article belong to their owners and are used only to name the software and services involved. Kaeso is not affiliated with or endorsed by them.
By Kaeso Team


