---
title: A self-hosted alternative to OpenRouter
description: "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."
url: https://kaeso.app/articles/self-hosted-openrouter-alternative
markdown: https://kaeso.app/articles/self-hosted-openrouter-alternative.md
language: en
alternates:
  de: https://kaeso.app/de/articles/self-hosted-openrouter-alternative.md
  zh-CN: https://kaeso.app/zh-CN/articles/self-hosted-openrouter-alternative.md
published: 2026-11-23
authors:
  - Kaeso Team
tags:
  - comparison
  - openrouter
  - self-hosted
  - gateway
image: https://kaeso.app/articles/self-hosted-openrouter-alternative/cover.jpg
index: https://kaeso.app/llms.txt
---

# 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.

> Every page, article and docs page of Kaeso is listed in https://kaeso.app/llms.txt.

- Published: 23 November 2026
- 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 OpenRouter

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](https://kaeso.app/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](https://kaeso.app/compare).

## OpenRouter vs Kaeso

| 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 migrate

Switching off OpenRouter does not have to be all-or-nothing. **OpenRouter is one of Kaeso's 50 built-in providers** ([supported providers](https://kaeso.app/providers)).

Many teams start by adding their direct OpenAI, Anthropic and Google AI Studio keys to Kaeso alongside their existing OpenRouter key:

1. Route 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.
2. Keep OpenRouter connected in Kaeso for experimental or long-tail open-weight models you do not want separate vendor accounts for yet.
3. Add a local Ollama or vLLM server as a custom provider for private or zero-token-cost workloads.
4. Put 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](https://kaeso.app/articles/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 Kaeso

```diff
 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](https://kpmr.kaeso.app), Kaeso's signed model registry, or can be overridden per project.

## When OpenRouter is still the better choice

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](https://kaeso.app/articles/where-to-run-kaeso). For how Kaeso keeps keys and logs under your control, read [Request logs and privacy](https://kaeso.app/articles/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

## More articles

- [Kaeso vs LiteLLM: architecture, benchmarks and trade-offs](https://kaeso.app/articles/kaeso-vs-litellm.md): A factual comparison of Kaeso 0.7.0 and LiteLLM (Python and Rust) across throughput, streaming latency, licensing, SSO, budgets, routing and operations.
- [One API for OpenAI, Anthropic, Gemini and local models](https://kaeso.app/articles/one-api-for-openai-anthropic-gemini-and-local-models.md): Which open-source AI gateways unify OpenAI, Anthropic, Google Gemini and local servers like Ollama and vLLM under one API, and how Kaeso translates five formats without dropping parameters.

[See all articles](https://kaeso.app/articles.md)

## Own the gateway. Own the record

```bash
curl -fsSL https://kaeso.app/install.sh | sh
```

[Install Kaeso](https://docs.kaeso.app/self-hosting/installation) · [Open the live demo](https://demo.kaeso.app)
