LiteLLM vs. OpenRouter — who operates the layer matters more than the models

LiteLLM vs OpenRouter is a gateway decision. LiteLLM runs inside your own tenant as self-hosted software with budgets, audit-grade logging and full data control; OpenRouter routes to many models behind one hosted API key. LiteLLM wins when requests must not leave the estate. Pexon deploys LiteLLM for regulated workloads.

Both give you many models behind one API. The difference is who is in the middle.

LiteLLM and OpenRouter solve the same surface problem: an application should call one endpoint and reach any model, without a key and an SDK per provider. That is where the similarity ends. LiteLLM is software you run inside your own tenant; OpenRouter is a hosted service that sits between you and the models. Every request you send through OpenRouter passes through their infrastructure. Every request through LiteLLM stays inside your boundary.

For a team with no residency constraint and a desire to move fast, OpenRouter is the less work by a wide margin. For a team whose requests may not leave the estate, or whose spend attribution has to survive an audit, the hosted option is not available in the first place.

LiteLLM runs in your tenant with budgets, audit-grade logging and full control. OpenRouter routes to hundreds of models behind one hosted API key. The decision is where the data goes and who operates the layer.

LiteLLM versus OpenRouter, side by side

DimensionLiteLLMOpenRouter
ModelOpen-source software you runHosted service
Where requests goYour tenantOpenRouter infrastructure
Setup timeHours to daysMinutes
Budgets and per-team limitsYes, enforcedLimited
Audit-grade loggingYes, yoursVendor-provided
Data residencyYour controlVendor regions
Fallback routingYes, configurableYes

Both support the OpenAI-compatible API surface, so applications switch by changing a base URL. The differences that matter are the ones above the API layer: control, residency and audit.

If requests may not leave your tenant, or spend attribution has to survive an audit, the hosted trade stops being available and LiteLLM is the answer. If neither constraint applies, OpenRouter is genuinely less work — and we will say so.

What the self-hosted gateway actually buys

The value of LiteLLM is not the routing — that is commodity. It is what the routing enables when the gateway is yours: per-team budgets enforced at the gateway rather than discovered at month end, request logging with retention set to what your works council agreed, and the ability to route one workload to a self-hosted model and another to a frontier API from the same configuration file.

The honest cost is that a gateway is a component you operate. On the day it fails, everything fails together — which is why it ships with fallback routing, health checks and its own alerting, and why the runbook is part of the deliverable.

One alias, two routes

Switching vendors or adding a provider is a configuration change, not a deployment.

# LiteLLM config: one API for the estate
model_list:
  - model_name: chat-default
    litellm_params:
      model: anthropic/claude-opus-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: chat-fallback
    litellm_params:
      model: openrouter/google/gemini-2.5-pro
      api_key: os.environ/OPENROUTER_API_KEY

router_settings:
  routing_strategy: simple-shuffle
  fallbacks:
    chat-default: ["chat-fallback"]

The strongest argument against any gateway is that it is a dependency — a lowest-common-denominator layer that converges on plain chat completion. Our answer is two-part: run it as software you own, and make it the default path rather than a mandate. Workloads that need a vendor-specific capability call that vendor directly, recorded as deliberately non-portable.

Three decisions that settle the gateway question

Each one is answerable in an afternoon, and each decides the architecture.

  • May requests leave the estate? If the answer is no, the hosted option is off the table and LiteLLM (or equivalent self-hosted software) is the only lane.
  • Does spend attribution have to survive an audit? Per-team budgets and request logs are the difference between a gateway that is an optimisation and one that is a control.
  • How many applications will hold keys? The first integration is a key in an environment variable. The fifth is a governance problem — the gateway should exist before the fifth team asks.

The first Claude integration is a key in an environment variable. The fifth is a governance problem.

Continue on the gateway and the stack

Gateway questions

What is the difference between LiteLLM and OpenRouter?

LiteLLM is open-source software you run yourself: a gateway in your own tenant that routes to any model provider, with budgets, logging and fallback. OpenRouter is a hosted service: you call one API and it routes to hundreds of models for you. The difference is where the data goes and who operates the layer — which is why regulated workloads end up on LiteLLM.

When should we use OpenRouter instead of LiteLLM?

When setup speed matters more than data control: a team experimenting with many models, a prototype, or a workload with no residency constraint. OpenRouter is less work because the routing, the billing and the model catalogue are managed for you. The trade is that every request passes through a third party.

Can we use LiteLLM and OpenRouter together?

Yes. A common pattern is LiteLLM inside your tenant as the primary gateway, with OpenRouter as one of the routing targets for models LiteLLM cannot reach directly. The gateway stays yours; OpenRouter becomes a provider among providers.

Next step

Decide the gateway before the fifth application needs a key

Two-week readiness blueprint at €4,900: we inventory what already calls a model, measure the spend, and deploy the gateway that fits your residency and audit requirements. The plan is yours to keep whoever builds it.