AI

LiteLLM vs OpenRouter: Which LLM Gateway Wins?

LiteLLM is an MIT-licensed gateway you self-host. OpenRouter is a hosted service charging 5.5% on credits and 5% on BYOK above allowance. They are not the same category. Here is the decision table, the real pricing, and which one to put in front of your app.

LiteLLM project brand image, used as the cover for a LiteLLM versus OpenRouter gateway comparison
Image: LiteLLM

TL;DR

  • LiteLLM is an open-source gateway you self-host. MIT licensed, free forever, with a paid Enterprise tier priced by annual request capacity — never per token.
  • OpenRouter is a hosted service. It charges 5.5% ($0.80 minimum) when you buy credits and takes no markup on inference itself.
  • Using your own provider keys (BYOK) on OpenRouter costs 5% of what the request would have cost on OpenRouter, above a $25,000/month list-price allowance on pay-as-you-go.
  • Verdict: self-host LiteLLM if keys, data residency or audit logs matter. Use OpenRouter if you want hundreds of models today and zero infrastructure.

LiteLLM is an open-source Python library and self-hosted proxy under an MIT licence. OpenRouter is a hosted commercial service that routes your requests through its own infrastructure and billing. Pick LiteLLM to keep keys and data inside your own infrastructure. Pick OpenRouter to reach hundreds of models without running anything yourself.

LiteLLM vs OpenRouter: they are not the same category

The comparison confuses people because the two products answer the same question in opposite ways.

LiteLLM is software. You pip install it or run the proxy container, you point it at your own OpenAI, Anthropic and Bedrock keys, and requests leave from your network. No third party sits in the request path.

OpenRouter is a service. You create an account, load credits, and get one API key. OpenRouter holds the relationships with upstream providers and your traffic transits its infrastructure.

That single structural difference drives almost every other trade-off below — cost model, data handling, failover behaviour, compliance posture. It is also why the gateway layer has become such contested commercial ground.

What is LiteLLM?

LiteLLM is an open-source LLM gateway that gives you one OpenAI-compatible interface to 100+ providers. It ships in two forms: a Python SDK you call in-process, and a proxy server you deploy as a standalone service in front of your applications.

The proxy is the part most teams actually want. It adds virtual keys, budgets, rate limits, spend tracking and fallbacks on top of the unified API.

Your provider keys stay in your config or secret manager. LiteLLM the company never sees your traffic.

Is LiteLLM open source?

Yes, with one precise caveat worth knowing before you plan a rollout.

The LiteLLM repository is MIT licensed, except for everything under the enterprise/ directory, which carries its own separate licence. So the gateway, the routing logic, the provider integrations and the SDK are genuinely MIT. SSO, SCIM, audit logs and JWT auth sit behind the commercial tier.

That is a source-available carve-out on a mostly-MIT project. Not a rug-pull, but not pure MIT either.

What does LiteLLM cost?

Nothing, if you self-host. The open-source gateway is free to self-host with no licence fee, including virtual keys, budgets, rate limits, fallbacks and Prometheus metrics.

Enterprise pricing is not published. LiteLLM states it is sized to your annual gateway request capacity, deployment architecture and support needs — explicitly not per token. You have to talk to sales for a figure.

Enterprise adds SSO and SCIM, OIDC/JWT auth, audit logs, secret-manager integration with key rotation, air-gapped deployment and 24/7 support. The company lists SOC 2 Type 2 and ISO 27001.

Remember the real cost either way: you pay your own infrastructure bill and someone on your team owns the uptime.

What does OpenRouter cost?

OpenRouter passes through provider pricing with no markup on inference. It makes money on the top-up.

Buying credits by card costs a 5.5% fee, with a $0.80 minimum. Crypto payments are 5%. Unused credits are refundable only within 24 hours of purchase, and the platform fee itself is never refundable. OpenRouter also reserves the right to expire unused credits after one year.

The BYOK fee is the number most people miss. If you bring your own provider keys, OpenRouter charges 5% of what that model and provider would normally cost on OpenRouter, deducted from your credits. There is a free allowance first, measured by list-price inference cost rather than request count: $25,000 per month on pay-as-you-go, $200,000 per month on Enterprise.

So BYOK is genuinely free for most teams. Past the allowance, you are paying a percentage on inference you already paid your provider for — the toll-booth dynamic that made OpenRouter an acquisition target in the first place.

LiteLLM vs OpenRouter: the decision table

Dimension LiteLLM OpenRouter
Category Open-source library + self-hosted proxy Hosted commercial routing service
Licence MIT, except enterprise/ directory Proprietary SaaS
Who holds provider keys You, in your own infrastructure OpenRouter (or your keys, encrypted, via BYOK)
Where traffic flows Your network to the provider Through OpenRouter's infrastructure
Cost model Free self-hosted; Enterprise by annual request capacity 5.5% on credit top-ups; 5% BYOK above allowance
Inference markup None — you pay providers directly None — pass-through pricing
Setup effort Deploy and operate a service API key, minutes
Failover Configurable fallbacks, retries, cooldowns, load balancing Automatic provider fallback, :nitro / :floor routing variants
Data logging Yours to configure; nothing leaves your infra Metadata only by default; prompt logging is opt-in for a 1% discount
Observability Prometheus metrics, spend by key/user/team/org Activity dashboard, filter by model/provider/key
Compliance SOC 2 Type 2, ISO 27001, air-gap available Terms and privacy policy; no air-gap option

Which routing model actually fails better?

Both handle failover, differently.

OpenRouter pools provider uptime. If a provider errors, it falls back to the next one transparently. You can bias routing with model suffixes: :nitro sorts by throughput, :floor sorts by price. That pooling is the strongest argument for the hosted model — you inherit redundancy you did not build.

LiteLLM gives you fallbacks, retries, cooldowns, tag-based routing and health-check-driven routing that you configure yourself. More control, more rope.

One asymmetry to weigh: with OpenRouter, OpenRouter itself is a dependency. Its outage is your outage. With LiteLLM, you are the single point of failure instead.

What this means for you

If you're a solo dev or prototyping: OpenRouter. One key, hundreds of models, no container to babysit. The 5.5% top-up fee is cheaper than an hour of your time. Revisit when spend gets real.

If you're a startup with product-market fit: start on OpenRouter, keep LiteLLM in mind. The switch cost is low because both speak the OpenAI format. Move when your monthly fee exceeds what an engineer would spend operating a proxy.

If you run a platform team: LiteLLM, self-hosted. You need per-team virtual keys, budgets and spend attribution, and you almost certainly need your provider keys to stay in your own secret manager.

If you're in a regulated industry: LiteLLM Enterprise. Air-gapped deployment, audit logs and SSO are not optional for you, and routing prompts through a third party will not survive review.

If you're optimising purely for model breadth: OpenRouter. Day-zero access to new models across labs, without you negotiating access with each provider. If you want the wider field before deciding, our comparison of the leading AI gateways covers the rest of the category.

Frequently Asked Questions

What is LiteLLM used for?

Teams use LiteLLM to put one OpenAI-compatible endpoint in front of every model they call. It handles provider translation, load balancing, fallbacks, retries, per-team virtual keys, budgets and spend tracking. Most production deployments run the proxy server rather than the Python SDK, because the proxy centralises governance across applications.

Is LiteLLM open source?

Yes. The repository is MIT licensed, apart from the enterprise/ directory, which has its own separate licence. The gateway, routing logic and 100+ provider integrations are all MIT. Enterprise-only features — SSO, SCIM, audit logs, OIDC/JWT auth — are licensed commercially and require a paid agreement.

Can you use LiteLLM and OpenRouter together?

Yes, and it is a common pattern. LiteLLM treats OpenRouter as just another provider: set OPENROUTER_API_KEY and call openrouter/<model>. You keep LiteLLM's governance, budgets and key management, while using OpenRouter for long-tail model access you have no direct contract for.

What are the best OpenRouter alternatives?

LiteLLM is the main open-source alternative if you want to self-host. Beyond those two, the LLM gateway category includes several hosted and open-source options with similar OpenAI-compatible interfaces. The real choice is not brand but architecture: hosted service versus self-hosted proxy, and who ends up holding your provider keys.

Does OpenRouter log my prompts?

Not by default. OpenRouter logs request metadata — timestamps, model, token counts — but states it does zero logging of prompts and completions unless you opt in. Opting in earns a 1% usage discount. Providers that log, or whose policy is unconfirmed, are not routed to unless you enable model training.

Routing is only half the stack. For the layer that records what those calls actually did, see Langfuse vs LangSmith.


Editor's note — sources: Fees, licence terms and product behaviour were verified on 24 September 2026 against OpenRouter's FAQ and BYOK documentation, the LiteLLM repository licence, LiteLLM's pricing page, and the LiteLLM proxy and routing documentation — all linked inline above. LiteLLM's Enterprise support SLAs and its SOC 2 Type 2 / ISO 27001 claims come from the company's own enterprise page and are not independently audited here. OpenRouter's fee percentages and BYOK allowances have changed before; check the current pages before modelling costs.

Get Edgewisely in your inbox

Business stories that matter, free. Enter your email — no password, no account to set up.
jamie@example.com
Subscribe