Guide

Can you self-host OpenRouter? What to run instead

OpenRouter can't be self-hosted. Here are the gateways that give you the same one-API setup on your own servers, and how to choose between them.

No. OpenRouter is only offered as a hosted service, so every request goes through its infrastructure. To get the same setup on your own servers, one API key and one OpenAI-compatible endpoint in front of many models, you run a self-hosted LLM gateway such as LiteLLM, Bifrost, Portkey's open-source gateway or AI Gateway by LayerX.

Facts checked between 27 November and 2 December 2026.

What you're actually replacing

OpenRouter bundles three things. A self-hosted setup has to cover the ones you need:

OpenRouter gives youSelf-hosted equivalent
One OpenAI-compatible endpoint for many modelsA gateway on your servers
Accounts and billing with 400+ modelsYour own accounts with each provider (or OpenRouter as one provider behind your gateway)
Routing and fallback between providersThe gateway's routing rules

The first and third are what a gateway does. The second, one bill for hundreds of models, is the part you give up unless you keep OpenRouter as one of your providers.

Gateways vs model servers: don't mix them up

Some "self-hosted OpenRouter" lists include vLLM and Ollama. Those are model servers: they run a model on your GPU and expose it as an API. They don't route between providers, issue keys to users or track spend. You'll usually run them behind a gateway, not instead of one.

your apps → gateway (keys, limits, routing) → vLLM / Ollama on your GPUs
                                            → OpenAI, Groq, OpenRouter...

If you only need to expose your own models, see an OpenAI-compatible API for your own models. For balancing many vLLM replicas, see vLLM router.

The self-hosted options

GatewayLicenceLanguageStrong atThink twice if
LiteLLMMIT, plus paid EnterprisePython100+ providers, mature feature setYou don't want to run Postgres and Redis
BifrostApache 2.0, plus enterprise deploymentsGoLow overhead, simple startYou need guardrails or clustering in the free build
Portkey gatewayMITTypeScriptGuardrails-first designYou want the commercial platform, now sold by Palo Alto Networks
AI GatewayCommercialNot applicableYour own GPUs first, per-person budgetsYou need non-OpenAI-compatible providers natively

LiteLLM

The most widely used option. The open-source proxy includes virtual keys, budgets and rate limits, spend tracking, an admin UI, load balancing and a guardrails framework. It needs Postgres, and Redis once you run more than one instance (LiteLLM docs). SSO beyond 5 users, audit logs, secret managers and support SLAs need an Enterprise licence (LiteLLM Enterprise).

In 2026 two malicious LiteLLM releases reached PyPI. If you self-host it, pin versions and verify signed images. See the LiteLLM supply chain attack, explained.

Bifrost

A Go gateway from Maxim AI that you can start with one command (npx -y @maximhq/bifrost or docker run -p 8080:8080 maximhq/bifrost) and configure in a web UI. Maxim reports 11 microseconds of overhead at 5,000 requests per second on a t3.xlarge (GitHub). Treat vendor benchmarks as a starting point and test with your own traffic. Compared in detail in Bifrost vs LiteLLM.

Portkey's open-source gateway

Portkey's gateway is MIT-licensed and you can run it yourself. The company's commercial platform, with observability and governance on top, now belongs to Palo Alto Networks as Prisma AIRS AI Gateway. More in Portkey vs LiteLLM.

AI Gateway by LayerX

AI Gateway is built for the case where "self-hosted" includes the models, not just the gateway. You register your vLLM or Ollama servers and your vendor accounts. Requests go to your GPUs first and move to vendors automatically when your machines are busy, down or rate-limited. Health checks, concurrency limits and prefix-cache affinity are designed for self-hosted machines.

On the people side, admins invite users by email, each user signs in with a 6-digit code and gets their own keys, daily and monthly token budgets, and a list of allowed models. The dashboard shows cost per user, key, model and provider. Prompts and responses are never stored. It runs on your servers, or LayerX hosts and manages it for you.

It's deliberately narrower than LiteLLM: OpenAI-compatible providers only (Anthropic and Gemini through OpenRouter), chat, embeddings and model listing endpoints, no caching or guardrails, and one organisation per install.

A hybrid setup: your gateway, with OpenRouter behind it

You don't have to choose between your own gateway and OpenRouter's catalogue. Put a self-hosted gateway in front, and add OpenRouter as one provider behind it:

  1. Your own models on vLLM or Ollama take the traffic they can handle.
  2. Direct provider accounts (OpenAI, Groq, Together) handle the rest.
  3. OpenRouter covers long-tail models you don't want separate accounts for.

Keys, budgets and usage stay in your gateway. Only requests you choose to send to OpenRouter leave your network. LiteLLM and AI Gateway both support OpenRouter as a provider.

How to choose

Answer these four questions:

  1. Do you run your own GPUs? If yes, look at how each gateway handles health checks and load across your own machines, not just vendor fallback.
  2. How many people need access? A few apps can share keys. Hundreds of people need per-person keys, budgets and model lists.
  3. Who will run it? A Python proxy with Postgres and Redis, a single Go binary, or a managed install are very different amounts of work.
  4. What must never be stored? Check each gateway's defaults for prompt logging.

Questions

Can I self-host OpenRouter?

No. OpenRouter is a hosted service with no self-hosted edition. Self-hosted gateways like LiteLLM, Bifrost, Portkey's gateway and AI Gateway give you the same one-API pattern on your own servers.

What is the best self-hosted alternative to OpenRouter?

LiteLLM for the widest provider coverage, Bifrost for a light Go gateway, and AI Gateway if you're serving your own GPUs to many users. All three give your apps one OpenAI-compatible endpoint.

Are vLLM and Ollama OpenRouter alternatives?

Not on their own. They serve models on your hardware. You still need a gateway in front of them for keys, limits, routing and cost tracking.

Can I use OpenRouter and a self-hosted gateway together?

Yes. Add OpenRouter as a provider in your gateway. You keep its model catalogue, and keys and budgets stay under your control.

More posts

Keep reading.

See how AI Gateway fits your setup.

Tell us what you run today and how many people need access. We'll get back to you to learn more about your setup.

See how AI Gateway fits your setup.

What do you run today?