HorizonLux · AI automation

Ship AI agents that reach production

Only about 5% of enterprise agents ever go live. We build the evaluation, routing and cost control that get yours there.

Book a free scoping call
Guides

OpenRouter vs LiteLLM: Which Risk You Own

Every comparison frames this as control versus convenience, with self-hosting as the safe choice. Self-hosting a gateway means owning a database full of every provider key you have, and owning the clock when it needs patching.

A self-hosted gateway database holding every provider key, next to a managed router where the keys sit with the vendor

TL;DR

Every comparison of these two frames it as control versus convenience, and treats self-hosting as the cautious option. That framing hides what you are actually choosing. A self-hosted gateway concentrates every provider key you have into one database, and makes you the party responsible for patching the thing in front of it. OpenRouter moves that concentration to somebody else's infrastructure along with your request data. Neither is safe in the abstract. You are picking which failure you would rather own.

This post is about the gateway decision itself. Reducing the bill once you have one is a separate exercise.

Standing up a gateway for more than one team? We design the AI systems around who carries the operational load, because that is the part that decides whether a self-hosted proxy is an asset or a liability in month eight.

Key Takeaways

  • The real split is not control versus convenience. It is which risk you absorb: a credential store and a patch obligation, or a third party in your request path.
  • In April 2026, LiteLLM disclosed CVE-2026-42208, a SQL injection in the proxy's API key verification path affecting v1.81.16 through v1.83.6. It was found through their own bug bounty and patched before disclosure, which is the process working.
  • What followed is the part worth planning for. Sysdig observed exploitation attempts around 36 hours after disclosure, and CISA added it to the Known Exploited Vulnerabilities catalog on 8 May. Self-hosting means that clock is yours.
  • LiteLLM's Rust gateway is real and dramatic, cutting p99 added latency from 257.7ms to 0.7ms in their own benchmarks. It is also an early beta behind a signup form with streaming still landing, so it is not something to plan a migration around yet.
  • Per-team cost attribution is the most oversold feature in this category. Practitioners running LiteLLM at scale report tracking that works as one pool rather than per team or per app.

What a gateway actually centralises

Both products put one endpoint in front of many model providers. The difference is where the keys live.

With LiteLLM, you run the proxy and a PostgreSQL database. That database holds your virtual keys, your budgets, your usage records, and the provider credentials the proxy uses to reach OpenAI, Anthropic, Bedrock and everything else. That is the point of it. It is also, in security terms, a concentration of every credential you own behind one process.

With OpenRouter, there is nothing to deploy. You hold one key, they hold the provider relationships, and your requests transit their platform on the way out.

Where provider credentials sit in each modelTwo panels. On the left, self-hosted LiteLLM: three application boxes point to a proxy, which sits above a database drawn as a highlighted vault containing every provider key, all inside a boundary marked your infrastructure and your patching. On the right, OpenRouter: three application boxes point outward across a boundary to a managed platform that holds the provider keys, with the request data crossing that boundary too.The keys move, they do not disappearLiteLLM, self-hostedyour infrastructure, your patchingappappappLiteLLM proxyPostgresevery provider key you ownone process guards all of itOpenRouter, managedappappappyour boundary ends hereOpenRouter platformholds the provider keystheir uptime and their patching
Nobody escapes the concentration. The only question is whether the vault is inside your boundary or outside it, and who is on call when it needs work.

The part the comparisons leave out

On 29 April 2026, LiteLLM disclosed CVE-2026-42208, a SQL injection in the proxy's API key verification path. A crafted Authorization header on a normal endpoint could reach the Postgres database behind the proxy without authenticating first. Versions v1.81.16 through v1.83.6 were affected, with the fix in v1.83.7 and v1.83.10-stable recommended.

Two things deserve saying plainly, because the story is often told badly in both directions.

LiteLLM handled it well. The flaw came in through their own bug bounty programme and was patched before public disclosure. They published the affected range, a recommended version, and a Postgres query to help operators audit their own history. That is what good disclosure looks like, and it is not an argument against the project.

The window afterwards is the operational reality. Sysdig reported targeted exploitation attempts roughly 36 hours after disclosure, and CISA added the CVE to its Known Exploited Vulnerabilities catalog on 8 May with a federal patch deadline three days later.

The patch window after disclosureA horizontal timeline with four marked points: disclosure on 29 April, observed exploitation attempts roughly 36 hours later, addition to the CISA Known Exploited Vulnerabilities catalogue on 8 May, and a federal patch deadline on 11 May. The span between disclosure and observed exploitation is shaded to show how narrow the response window was.Self-hosting means this clock is yours29 Aprdisclosedpatch available+36hexploitation observed8 Mayadded to CISA KEV11 Mayfederal deadlineA managed gateway would have patched this for you. That is the trade, stated honestly.
Nothing here is unusual for infrastructure software. It is only surprising if you adopted a self-hosted proxy believing it removed risk rather than relocating it.

If you run LiteLLM, this is a normal and manageable obligation, the same one you carry for any internet-facing service. If you chose it because a blog post told you self-hosting was the secure option and nobody mentioned patch duty, it is a surprise arriving at the worst moment.

The overhead nobody quotes

The other thing missing from these comparisons is what the Python proxy costs you in latency. LiteLLM's own published benchmarks put the Python gateway at 257.7ms of p99 added latency, against 2.3ms for Portkey and 4.5ms for Bifrost.

Their answer is a Rust rewrite, and the numbers are striking:

LiteLLM Rust LiteLLM Python Portkey Bifrost
p99 added latency 0.7ms 257.7ms 2.3ms 4.5ms
Peak memory 21.8MB 329.5MB 90.4MB 199.1MB
Cost per million requests $0.000175 $0.015354 $0.001042 $0.001008

On a 30-turn Claude Code session, they measure the Rust path adding 0.03 seconds against the Python path's 0.97 seconds.

Read the status before you plan around it. LiteLLM describes the Rust gateway as an early beta behind a signup form, with streaming and the full feature surface still landing. Coverage elsewhere has reported it as though it shipped. It has not, and these are vendor benchmarks on vendor hardware, so treat the ratios as directional and the absolute numbers as a starting hypothesis.

Two claims worth deflating

A gateway does not raise your provider rate limits. If you bring your own Anthropic key, you are still inside Anthropic's limits for that key. Routing through a proxy changes where retries and fallbacks are configured, not what the upstream will accept.

Per-team cost attribution is harder than the feature list implies. Teams running LiteLLM at scale describe usage tracking that behaves as one aggregate pool, making it difficult to say which team or which application caused a spike, and end up building tagging and dashboards on top. Budget enforcement per virtual key is real. Clean attribution after the fact is the part that takes work.

Side by side

OpenRouter LiteLLM
Shape Managed service, nothing to deploy Proxy plus Postgres that you run
Where provider keys sit With OpenRouter In your database
Who patches the gateway OpenRouter You, on their disclosure clock
Request data path Transits their platform Stays in your network until the provider call
Billing Credits, one invoice You pay each provider directly
Added latency Managed, consistent 257.7ms p99 on Python, 0.7ms on the Rust beta
Fails when They have an outage or change limits You have an outage, or miss a patch

Which to pick

The failure modes each option hands youA central box representing your AI features, with three arrows arriving from the left labelled with OpenRouter failure modes and three arrows arriving from the right labelled with LiteLLM failure modes. Both sides point inward at the same target, showing that neither option removes risk and each simply delivers a different set.Both arrows point at youOpenRouter hands youtheir outage is your outageyour data crosses their boundarytheir limits, their pricingYour AI featuresand whoever is on callLiteLLM hands youyou patch on their clockyou scale it and monitor itattribution needs buildingPick the column your team can actually absorb.That is a staffing answer, not an architecture preference.
Most comparisons only draw the left column, then call the right column “control”. Both are lists of things that will page someone.

Pick OpenRouter if you do not have someone whose job includes patching a tier-zero service inside a week. That is a real staffing question, not a philosophical one, and answering it honestly is more useful than any feature table. You also get breadth of model access immediately and one invoice.

Pick LiteLLM if data residency or compliance requires the request path to stay inside your network, and you have the operational capacity to treat it as production infrastructure: patch alerts, an upgrade path, monitoring, and someone accountable for all three.

Run both if you want the self-hosted control plane and the managed breadth. LiteLLM in front as your single internal endpoint, OpenRouter configured as one of the providers behind it. You keep virtual keys and budgets in your own hands, and you inherit model coverage you did not have to negotiate. You also keep the patch obligation, so this is not a way to avoid the choice above.

Frequently asked questions

Is self-hosting LiteLLM more secure than using OpenRouter?

It is differently secure. Self-hosting keeps request data inside your network, and concentrates every provider credential you hold into one database behind one process that you are responsible for patching. CVE-2026-42208 in April 2026 is the concrete illustration: disclosed and patched responsibly, exploited in the wild within roughly 36 hours, added to CISA's KEV catalog nine days later. Whether that is safer than a managed platform depends entirely on your patch response time.

Can I use OpenRouter as a provider inside LiteLLM?

Yes, and it is a common arrangement. Applications call your LiteLLM endpoint and get your virtual keys and budgets, while OpenRouter sits behind it supplying model breadth. It does not reduce your operational responsibility for the proxy.

Will a gateway get around provider rate limits?

No. With your own provider key you remain subject to that provider's limits. A gateway changes where fallback and retry logic lives, which can make limits less disruptive, but it cannot raise a ceiling the provider sets.

Is the LiteLLM Rust gateway ready to use?

Not for production planning as of August 2026. LiteLLM describes it as an early beta requiring signup, with streaming and full feature parity still in progress. The published benchmarks are dramatic, and the direction is clear, but a beta is not a migration target.

Which is cheaper?

At low and bursty volume, OpenRouter usually wins because there is no infrastructure to pay for. At steady high volume, self-hosting can win on paper, provided you count the engineering time to run it. That second term is the one teams underestimate, and it is the most common reason people migrate off a self-hosted proxy after several months.

Sources

Ship AI agents that reach production

Only about 5% of enterprise agents ever go live. We build the evaluation, routing and cost control that get yours there.

Prefer email? [email protected]