---
title: "OpenRouter vs LiteLLM (2026): Hosted AI Gateway vs Open-Source LLM Proxy"
description: "OpenRouter is a hosted service: one key, 500+ models, a 5.5% fee on credits. LiteLLM is MIT-licensed software you run yourself, with virtual keys and budgets per team. How each works, what each one really costs at three spend levels, and why this site runs on OpenRouter."
source: https://appstackbuilder.com/blog/openrouter-vs-litellm-2026
retrieved: 2026-10-12
---

[Back to Blog](https://appstackbuilder.com/blog)

AI Infrastructure2026 Guide

# OpenRouter vs LiteLLM: Choosing an AI Gateway in 2026

Both give your app one OpenAI-compatible endpoint in front of every model provider. The difference is who runs it. **OpenRouter** is a hosted service you pay a fee to. **LiteLLM** is open-source software you deploy yourself. We compare how each works, what each costs at $500, $5,000 and $50,000 a month of model spend, and explain why this site runs on one of them.

13 min read1 hosted, 1 open sourcePublished October 2026

## First: why put a gateway in front of your models?

Most AI features start as a direct call to one provider's SDK. That works until the provider rate-limits you, a cheaper model comes out on a different provider, or a second team starts using the same API key and nobody can say who spent what. Each of those turns into code changes spread across the app.

An **AI gateway** moves those decisions out of your code. The app calls one endpoint in the OpenAI format. The gateway decides which provider serves the request, retries or falls back when one fails, and records the tokens and cost of every call.

### Switch models without a deploy

Moving from one model to another becomes a changed string or config line, not a new SDK, new auth and a new response format.

### Survive a provider outage

When a provider returns errors or rate-limits, the request goes to the next one, and your users do not see an error page.

### Know where the money goes

Every call is logged with model, tokens and cost, so the monthly AI bill can be split by feature, customer or team.

### Keep the keys in one place

Provider keys live in the gateway, not in every service. Revoking access or rotating a key is one change.

**What it does not do:** it does not make models interchangeable. The same prompt behaves differently on different models, so switching still needs testing. And it adds one more thing that can fail between your app and the model. If the gateway is down, every AI feature is down with it.

**Do you need this yet?** If you call one model from one provider, from one app, the provider's own SDK is fine. A gateway starts paying off once you use two or more providers, need a fallback for an AI feature customers rely on, or have more than one team spending from the same budget.

## Quick Verdict

![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)OpenRouter

A hosted gateway and model marketplace. One key and one bill for 500+ models from 80+ providers, with routing and fallbacks handled for you. Nothing to deploy; you pay a fee on credits, or use your own provider keys.

Nothing to run500+ models

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)LiteLLM

An MIT-licensed Python SDK and proxy server you host yourself. Calls go straight from your servers to the providers you hold keys for, with virtual keys, budgets and rate limits per team or customer.

Open sourcePer-team budgets

TL;DR

No single winner. Pick on who should run the gateway. Want nothing to operate and the widest model choice → **OpenRouter**. Need traffic to stay inside your own infrastructure, or keys and budgets per team → **LiteLLM**. Need both → run LiteLLM and route some traffic through OpenRouter. And if you only call one model, you may not need either yet.

## The question that decides it: who runs the gateway?

Both accept OpenAI-format requests, both route across providers, and both fall back when one fails. Your application code looks almost the same either way. What differs is where the gateway lives, and that decides your bill, your data path and your on-call duties.

### 1\. A service someone else runs: OpenRouter

Your app sends requests to openrouter.ai, which runs on Cloudflare's edge, and OpenRouter forwards them to a provider. You buy credits once and get every model on one invoice. The trade: a third party sits in every request, you depend on its uptime, and it takes a fee on credits.

### 2\. Software you run: LiteLLM

You deploy the LiteLLM proxy as a container next to your app, with a Postgres database for keys and spend. Requests go from your servers directly to the providers you have accounts with. The trade: you host it, scale it, patch it, and you need a separate account and key with every provider.

A quick test: if nobody on the team wants to be paged for the gateway, that points to OpenRouter. If your security review says customer prompts may only go to the providers you have contracts with, that points to LiteLLM.

## The two, in detail

Plans, prices and limits as published on each vendor's site in October 2026\. Model usage is paid at the providers' list prices in both cases. The figures below are only what the gateway itself costs.

Nothing to deploy

![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)

### OpenRouter

Hosted gateway and model marketplace

5.5% fee on credits

No markup on inference; BYOK free up to $25K/mo list price

* 500+ models from 80+ providers on one key and one invoice
* Free tier: 25+ free models, 50 requests/day (1,000/day after buying $10 of credits)
* Default routing favors cheaper stable providers; sort by price, throughput or latency instead
* Automatic fallback to the next provider on errors
* Hard price caps per request (max\_price) and Zero Data Retention routing on every plan
* Prompts and completions not logged by default
* Passes through Anthropic, OpenAI and Gemini prompt caching, with sticky routing
* CaveatFees are charged when you buy credits and are non-refundable. Unused credits can be refunded only within 24 hours and may expire after a year. And OpenRouter is a single company in the path of every request, so its outage is your outage.

Best for: Startups and solo builders who want many models, one bill and no infrastructure to run.

Self-hosted

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)

### LiteLLM

Open-source SDK and proxy server

$0 license (MIT)

You pay for hosting; Enterprise is custom-priced

* 100+ providers behind one OpenAI-compatible API
* Python SDK, or a proxy server any OpenAI client can point at
* Virtual keys with budgets and rate limits per key, user or team
* Load balancing across deployments, with automatic fallbacks
* Caching, guardrails, logging callbacks and an admin UI
* Can route to OpenRouter itself as one of its providers
* Enterprise adds SSO/SCIM, audit logs, RBAC, secret managers and 24/7 support
* CaveatYou own the uptime and the patching. In March 2026 two malicious versions were pushed to PyPI with a stolen token (more below), so pin exact versions or image digests. Virtual keys and spend tracking need a Postgres database.

Best for: Teams with several apps or departments sharing AI spend, or rules that keep data inside their own infrastructure.

## What the gateway costs at three spend levels

Model usage costs the same either way, so this table shows only the gateway on top. OpenRouter figures come from its published October 2026 fees. LiteLLM figures are our hosting estimate for a small container plus managed Postgres, and a second instance with Redis at the top tier. They exclude anyone's time.

| Monthly model spend | OpenRouter, buying credits (5.5%) | OpenRouter, your own keys | LiteLLM, self-hosted |
| ------------------- | --------------------------------- | ------------------------- | -------------------- |
| $500                | \~$28                             | $0                        | \~$20–50 hosting     |
| $5,000              | \~$275                            | $0                        | \~$20–50 hosting     |
| $50,000             | \~$2,750                          | \~$1,250 (5% above $25K)  | \~$100–200 hosting   |

**The surprise in this table:** with your own provider keys, OpenRouter charges nothing until $25,000 a month of list-price usage. For most startups the fee is not a reason to self-host. The real reasons are where the traffic goes and how much control you need over keys and budgets. The cost case for LiteLLM only shows up at large volume, and by then the engineering time to run it matters more than its hosting bill.

## Feature comparison

Capability

![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)OpenRouter

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)LiteLLM

Who runs it

OpenRouter

You

Open source

✗

MIT

Models without your own provider accounts

✓

✗

Provider fallbacks

✓

✓

Per-team keys and budgets

Per API key

✓

Traffic stays in your infra

✗

✓

Prompt caching pass-through

✓

✓

Free models

25+

✗

Pricing

Fee on credits

Hosting only

Time to first request

Minutes

An afternoon

"Time to first request" is a rough guide for a team new to each tool, including a production-ready LiteLLM deploy with a database, not a benchmark.

## Latency, reliability and security

Comparison pages often skip these, and they are what people actually run into after launch.

### Added latency

OpenRouter publishes no overhead figure. It says it runs on Cloudflare Workers with edge caching and that latency rises briefly in a new region, when your credit balance is low, or during a fallback. LiteLLM claims 8ms P95 at 1,000 requests a second. That is its own benchmark. In a June 2026 benchmark by a competing gateway, LiteLLM's median was 7–12ms under load. Both are small next to a model's own response time of hundreds of milliseconds or more.

### Who holds your data

OpenRouter logs request metadata such as model, time and token counts, but not prompts or completions unless you opt in. You can also restrict routing to providers that do not train on data or that have zero data retention. With LiteLLM, prompts go only to providers you hold accounts with, and logs stay wherever you send them.

**The March 2026 LiteLLM incident:** on March 24, attackers who had stolen LiteLLM's PyPI publishing token released versions 1.82.7 and 1.82.8\. Those versions sent credentials from the machines that installed them to an attacker's server. The source on GitHub was never changed. The bad releases were live for about 40 minutes by LiteLLM's account, or about three hours by Snyk's. LiteLLM moved to a new isolated release pipeline from v1.83.0\. A self-hosted gateway holds every provider key you have, so pin exact versions or image digests and do not auto-upgrade it. A hosted gateway moves that risk to the vendor; it does not remove it.

## What we run on this site, and why

App Stack Builder's [stack generator](https://appstackbuilder.com/build-stack) and its AI chat both call models through OpenRouter. The generator originally used Google's Gemini API directly. When our prepaid Gemini credits ran out, every request started failing with rate-limit errors. Moving to OpenRouter turned the model into a single setting: the generator uses Claude Haiku 4.5, the chat uses Claude Sonnet 4.6, and changing either is an environment variable, not a code change.

The generator sends our full tool catalog in the system prompt on every request, so prompt caching matters. We mark that block with an Anthropic `cache_control` breakpoint, and OpenRouter forwards it to the provider. The usage field in each response reports how many tokens were cached, which is the number to watch.

Why not LiteLLM? We are one app with one key and no teams to budget for, so its strengths would go unused, and we would rather not run another service. If we had several products sharing an AI budget, or customers asking where their prompts go, we would decide differently.

## Which one should you pick?

### You are a small team shipping AI features

**OpenRouter.** One key, every model, no infrastructure. Start by buying credits. Once your spend is steady, add your own provider keys and the fee drops to zero until $25,000 a month.

![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)OpenRouter

### You want to try many models before committing

**OpenRouter.** New models show up there quickly, and comparing five of them takes five model strings, not five vendor sign-ups. The free models are enough for early prototyping.

![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)OpenRouter

### Several teams or customers share one AI budget

**LiteLLM.** Give each team, app or customer a virtual key with its own budget and rate limit, and see spend broken down by each. This is what platform teams usually adopt it for.

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)LiteLLM

### Prompts must not pass through a third party

**LiteLLM.** Regulated data, enterprise customer contracts or an air-gapped network all rule out a hosted middleman. LiteLLM runs inside your network and talks only to providers you choose, including models you host yourself.

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)LiteLLM

### You need control and a wide model menu

**Both.** Run LiteLLM for keys, budgets and logs, and add OpenRouter as one of its providers for models you do not have direct accounts with. You pay OpenRouter's fee only on that share of traffic.

![](https://www.google.com/s2/favicons?domain=litellm.ai&sz=128)![](https://www.google.com/s2/favicons?domain=openrouter.ai&sz=128)LiteLLM in front of OpenRouter

## Build the rest of the AI stack around it

Use our AI-powered generator to build a complete stack: model provider, vector database, observability, hosting and auth, sized to your budget and your team.

[Generate Your Tech Stack](https://appstackbuilder.com/build-stack?budget=100&appType=ai&teamSize=small)

## Frequently Asked Questions

### Which is better, OpenRouter or LiteLLM?

Neither is better overall. They solve the same problem from opposite sides. OpenRouter is a hosted service: you get one API key and 500+ models with nothing to run, and it charges a fee on the credits you buy. LiteLLM is open-source software you deploy yourself: no fee and no third party in your traffic path, but you run, secure and upgrade it. Pick OpenRouter if you want zero operations and the widest model menu. Pick LiteLLM if you need per-team keys and budgets, or your data must not pass through another company.

### How much does OpenRouter charge?

OpenRouter says it passes model prices through with no markup on inference, and charges a fee when you buy credits instead: 5.5% by card (minimum $0.80) on the Standard plan, 5% for crypto, and 8% on the Business plan. If you bring your own provider keys (BYOK), the first $25,000 of list-price inference each month carries no fee, and usage above that is charged 5%. Prices as listed in October 2026.

### Is LiteLLM free?

The open-source LiteLLM SDK and proxy are MIT-licensed and free to self-host. You pay for the server it runs on and a Postgres database, which the proxy needs for virtual keys and spend tracking. LiteLLM Enterprise adds SSO, audit logs, role-based access, secret-manager integration and 24/7 support at custom pricing, with a 30-day self-hosted trial.

### Can I use LiteLLM and OpenRouter together?

Yes, and many teams do. LiteLLM supports OpenRouter as a provider, so you can run LiteLLM for keys, budgets and logging inside your company, and send some or all traffic on to OpenRouter for access to models you do not have direct contracts with. You pay OpenRouter’s fee only on the traffic you route there.

### Does OpenRouter support prompt caching?

Yes. It forwards Anthropic cache\_control breakpoints, OpenAI automatic caching and Gemini implicit caching, and uses sticky routing to send follow-up requests for the same model to the same provider so the cache stays warm. Sticky sessions expire after 10 minutes of inactivity, and are not used if you pin a provider order yourself.

### Is LiteLLM safe after the March 2026 PyPI compromise?

On March 24, 2026, attackers used a stolen publishing token to push two malicious LiteLLM versions, 1.82.7 and 1.82.8, to PyPI. They stole credentials from machines that installed them and were live for roughly 40 minutes by LiteLLM’s account (about three hours by Snyk’s). The GitHub source was not changed. LiteLLM rebuilt its release pipeline and shipped v1.83.0 from it. The lesson applies to any self-hosted gateway: pin exact versions or image digests, verify hashes, and rotate keys if you installed an affected version.

### What is an AI gateway?

An AI gateway sits between your application and model providers such as OpenAI, Anthropic and Google. Your code calls one OpenAI-compatible endpoint, and the gateway handles which provider serves the request, retries and fallbacks when a provider fails, and records who used how many tokens. Switching models becomes a configuration change instead of a code change.

### Related Articles

[Best LLM Observability & Evals 2026Tracing and testing what the gateway sends](https://appstackbuilder.com/blog/llm-observability-evals-2026)[MCP in 2026: The Complete GuideConnecting models to your tools](https://appstackbuilder.com/blog/mcp-model-context-protocol-guide-2026)[GPT-5.6 vs Claude vs GeminiWhich models to route to](https://appstackbuilder.com/blog/gpt-5-6-vs-claude-vs-gemini-2026)

### Explore More

[All Blog Posts](https://appstackbuilder.com/blog)[LLM Providers](https://appstackbuilder.com/categories/llm-provider)[Vector Databases](https://appstackbuilder.com/blog/best-vector-database-rag-2026)[Stack Generator](https://appstackbuilder.com/build-stack)
