Usage & Billing

OpenRouter vs LiteLLM: Hosted Aggregator or Self-Hosted Gateway (2026)

ROIBest AI

OpenRouter vs LiteLLM: different products that solve the same symptom

People compare OpenRouter vs LiteLLM because both let one codebase call many models through an OpenAI-style API. They are not the same kind of product:

  • OpenRouter is a hosted service. You get one account, one API key and one balance, and OpenRouter forwards your requests to model providers it has contracts with.
  • LiteLLM is open-source software you run yourself: a Python SDK and a self-hosted proxy (which LiteLLM calls its AI Gateway). It sits in front of provider accounts you hold directly.

So the real question is not "which is better" but "do you want to buy access, or operate a gateway?" This page compares them on the points that decide that. For the category-level view (hosted aggregators versus self-hosted gateways in general), see LLM gateway vs OpenRouter; here we stay on these two products.

Facts below come from OpenRouter's FAQ and quickstart, and from LiteLLM's docs, enterprise page and March 2026 security update, all read on November 24, 2026. Pricing and feature lists change; check the source before you commit.

Side-by-side comparison

OpenRouter

LiteLLM

What it is

Hosted API aggregator

Open-source SDK + self-hosted proxy

Who runs it

OpenRouter

You (or LiteLLM Cloud / an Enterprise deployment)

Provider accounts

Not needed; OpenRouter's contracts

You bring a key for every provider

Endpoint

https://openrouter.ai/api/v1 (/chat/completions, /responses, /completions)

Your own URL, e.g. http://litellm:4000

Model coverage

The catalog OpenRouter lists (474 models in its public models API on Nov 24, 2026)

100+ providers, limited to the ones you hold keys for

How you pay

Prepaid credits; inference passed through at provider list price

Each provider bills you directly; the software itself is free

Platform fee

5.5% on credit purchases ($0.80 minimum), 5% for crypto

None for open source; Enterprise is a paid license

Bring your own key

Supported; free allowance, then 5% of normal OpenRouter cost

The default mode

Per-team keys and budgets

Account-level keys and spend controls

Virtual keys with per-key, team and user budgets and rate limits (needs PostgreSQL)

Fallbacks and load balancing

Provider routing and model fallbacks, configured per request

Router with fallbacks, retries and load balancing across your deployments

Where prompts go

Through OpenRouter to the provider

From your infrastructure straight to the provider

What you operate

Nothing

A service, a database, upgrades and security patches

Cost: the fee versus the ops bill

OpenRouter says it passes through provider pricing without markup and charges when you buy credits: 5.5% with a $0.80 minimum, or 5% for crypto. If you bring your own provider keys (BYOK), usage is free up to a plan-dependent allowance (pay-as-you-go includes $25,000 per month, measured at list-price inference cost), and above that OpenRouter charges 5% of what the same call would normally cost on OpenRouter.

LiteLLM adds no fee: you pay each provider at your own contract rate, which may include committed-use discounts OpenRouter cannot pass on. What you pay instead is infrastructure and time: a container or VM, a PostgreSQL database if you want virtual keys and spend tracking, monitoring, and upgrades. The Enterprise license (SSO and SCIM, audit logs, secret managers, IP allowlists, support SLAs) is a separate commercial product.

A rough rule: at low volume, the 5.5% is cheaper than anyone's time. At high volume on a few providers where you already have contracts, the fee becomes real money and a self-hosted gateway pays for itself. Our LLM API pricing comparison covers the other variables a rate table leaves out.

Control and governance

This is where LiteLLM is strongest. The proxy gives a platform team:

  • Virtual keys per developer, team or app, each with its own model allowlist, budget and rate limit.
  • Spend tracking per key, team and user across every provider.
  • Guardrails, caching and centralised logging, with callbacks to tools such as Langfuse.
  • An admin UI, and an MCP gateway with per-key access control.

OpenRouter offers account-level key management, spend controls and provider routing, which is enough for a single team or product. It is not designed to be your internal access-control layer across many teams with separate budgets.

Data path and compliance

With OpenRouter, every prompt passes through OpenRouter on its way to the provider. OpenRouter states it does not log prompts and completions unless you opt in, and it offers settings such as zero-data-retention routing. Your security review still has to approve one more processor in the path.

With LiteLLM self-hosted, prompts go from your infrastructure directly to each provider. Nothing extra sits in the path, which is why regulated teams often prefer it. The trade-off is that you own the security of that gateway.

Security: the March 2026 LiteLLM incident

On March 24, 2026, two LiteLLM releases on PyPI, 1.82.7 and 1.82.8, were published with credential-stealing malware after a CI/CD compromise linked to the Trivy supply-chain attack. They were live for a short window before PyPI quarantined them. LiteLLM states that users of the official proxy Docker image (ghcr.io/berriai/litellm) and LiteLLM Cloud were not affected, and clean releases resumed with v1.83.0.

The lesson is not "avoid LiteLLM". It is that a self-hosted gateway holds every provider key you own, so treat it like any other critical dependency: pin versions, prefer the official image, scan dependencies, and keep provider keys in a secret manager. Our guide to API key rotation covers what to do if a host is ever exposed.

You can use both

LiteLLM supports OpenRouter as an upstream provider. Send model="openrouter/<model-id>" with OPENROUTER_API_KEY set, and requests go through OpenRouter. A common pattern:

  • High-volume models go directly to providers where you hold contracts.
  • Long-tail or experimental models go through OpenRouter.
  • Developers see one internal LiteLLM endpoint with their own virtual keys and budgets.
# LiteLLM proxy config.yaml (excerpt)
model_list:
  - model_name: main-chat
    litellm_params:
      model: anthropic/claude-sonnet-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: long-tail
    litellm_params:
      model: openrouter/qwen/qwen3-max
      api_key: os.environ/OPENROUTER_API_KEY

Model IDs in the example are placeholders; use the IDs your providers list today. For a worked Claude-side configuration, see LiteLLM with Claude.

Which one to pick

Your situation

Better fit

Solo developer or small team, want many models today

OpenRouter

Prototyping, comparing models, no provider contracts yet

OpenRouter

Platform team serving many internal teams with separate budgets

LiteLLM

Existing enterprise contracts or committed-use discounts with providers

LiteLLM

Prompts must not pass through an extra third party

LiteLLM (self-hosted)

No one available to run and patch a service

OpenRouter

Want one internal endpoint and access to long-tail models

LiteLLM with OpenRouter as an upstream

If you are still choosing among self-hosted gateways, open-source LLM gateways compares LiteLLM with the other projects worth shortlisting.

FAQ

What is the main difference between OpenRouter and LiteLLM?

OpenRouter is a hosted service that sells access to many models through one account and key. LiteLLM is open-source software you run yourself to put one API in front of provider accounts you already hold.

Is LiteLLM cheaper than OpenRouter?

LiteLLM charges no fee, so you pay providers directly at your own rates. OpenRouter adds a 5.5% fee when you buy credits but passes through inference prices. LiteLLM is usually cheaper at high volume, but you pay for hosting and maintenance.

Can LiteLLM use OpenRouter?

Yes. LiteLLM supports OpenRouter as a provider: use model names prefixed with openrouter/ and set OPENROUTER_API_KEY.

Is LiteLLM safe after the 2026 PyPI incident?

The malicious releases were 1.82.7 and 1.82.8, published on March 24, 2026 and since removed. LiteLLM says the official Docker image was not affected and clean releases resumed with v1.83.0. Pin versions and rotate any credentials on hosts that installed the affected releases.

Does OpenRouter work with the OpenAI SDK?

Yes. Set the base URL to https://openrouter.ai/api/v1 and use your OpenRouter key. OpenRouter implements the OpenAI format for /chat/completions, /responses and /completions.

The short version

OpenRouter is the quickest way to reach many models with one key, at the cost of a 5.5% credit fee and one more party in the data path. LiteLLM gives you keys, budgets, routing and a direct data path on your own infrastructure, at the cost of running and securing it. Many teams end up with both: LiteLLM as the internal front door, OpenRouter as one of its upstreams.