When to Use LiteLLM Self-Hosted vs a Managed AI Gateway
ChatGPT, Claude and Grok all went down on the same morning. A gateway is how you survive that. Whether you should run it yourself is a different question.
On September 3, 2026, ChatGPT, Claude and Grok all had outages inside the same few hours. Claude was down for three hours and six minutes. Everything was back by 12:38pm Pacific, and the Hacker News thread asking why three providers broke at once ran to 688 comments.
If your app called one provider directly, your app was down too. If it went through a gateway with a fallback configured, it wasn't.
So the gateway question isn't really "should I have one". It's who runs it. And the answer people reach for, self-host it because the software is free, is wrong more often than it's right.
What Does a Gateway Actually Do?
One API in front of many providers, plus the things you'd otherwise build twice. Automatic fallback when a provider errors or times out. Spend caps per key so one runaway loop can't empty your account. Request logging you can search when a customer says the output was wrong. Caching for repeated prompts.
LiteLLM's open source proxy gives you all of that for free. 100 plus providers behind one OpenAI-shaped API, virtual keys, users and teams, spend tracking, budgets, rate limits, fallbacks, request and response logging, Prometheus metrics. It's a good piece of software and the licence costs nothing.
Worth saying plainly: a fallback only saves you if the backup provider serves a model you'd accept. Falling back from Claude to a model that can't follow your prompt format turns an outage into a stream of bad output, which is sometimes worse than an error your app can retry. Pick the second choice deliberately and test it before you need it.
That's the part everyone gets right. The next part is where the money actually is.
What Does Self-Hosting Really Cost?
Not much, in hardware. A Hetzner CX22 is €3.79 a month before VAT for 2 vCPUs, 4 GB of RAM, 40 GB of disk and 20 TB of traffic. That runs a LiteLLM proxy for a solo SaaS without breathing hard. On Railway you'd be at $5 a month on Hobby including $5 of usage credit, more once Postgres and Redis are running.
You need both of those, by the way. Postgres holds keys and spend records. Redis handles rate limiting and caching. At small scale they sit on the same box happily enough.
Then comes the actual cost. A gateway sits in the request path, which means its uptime is your uptime. Every AI feature you ship goes through it. When it falls over at 3am, your product is down and you are the on-call rotation. You've taken a thing that was somebody else's problem and made it yours, to save roughly the price of a coffee.
If you already run infrastructure and enjoy it, that trade is fine. Our Vercel, Railway and Hetzner comparison covers the same instinct applied to hosting generally. But price it honestly, because the server was never the expensive part.
What Does Managed Really Cost?
Less than the self-hosting crowd assumes, which is what makes this decision lopsided.
| Gateway | Free tier | Paid entry | Notes |
|---|---|---|---|
| Cloudflare AI Gateway | Core features free, all plans | Free | 100k logs on Workers Free, 10M per gateway on Workers Paid |
| Portkey | 10k logs/month, 3-day retention | $49/month | 100k logs, then $9 per extra 100k |
| Helicone | 10k requests/month, 1 seat | $79/month | 7-day retention free, 1 month on Pro |
| OpenRouter | No markup on inference | Free | 5.5% on Stripe credit purchases, 5% BYOK above $25k/month |
| LiteLLM self-hosted | Everything, forever | ~€4/month server | Plus Postgres, Redis and your own pager |
Cloudflare AI Gateway's core features are free on every plan, including dashboard analytics, caching and rate limiting. Logpush costs $0.05 per million requests above the 10 million base, and unified billing adds a 5% fee on credit purchases. For a solo builder that's effectively zero.
Read that table again with the self-hosting argument in mind. The pitch for running your own is cost, and the cheapest managed option costs nothing while somebody else carries the pager.
So When Does Self-Hosting Actually Win?
Three situations, and they're all about constraints rather than price.
Data residency and air-gap. If prompts can't leave your infrastructure, no hosted gateway works, and this is the reason that survives every argument. LiteLLM Enterprise supports air-gapped deployment for exactly this.
Routing logic nobody sells. Model choice by customer tier, a bespoke cost ceiling per tenant, a fallback order that depends on your own data. Hosted products express the common cases well and the unusual ones not at all.
Log volume. Per-log pricing is fine until it isn't. Portkey Production includes 100,000 logs for $49 and charges $9 for each additional 100,000. Run 3 million logs a month and you're at $49 plus 29 blocks of overage, which is $310. Against a €4 server that finally reads like a real argument, and it's the point where most teams should switch.
Getting there takes a while, though. Three million logs a month is roughly 100,000 requests a day, every day. Most solo products never see that, and the ones that do have revenue to match.
Notice what's missing. "I want to save $49 a month" is not on the list, because at that scale you're spending far more on tokens than on the gateway, and the gateway is the cheapest line on the invoice.
What About Portkey's Acquisition?
Palo Alto Networks completed its purchase of Portkey on May 29, 2026, and Portkey is now the AI Gateway inside Prisma AIRS, aimed at securing AI agents. The press release says nothing about the standalone product, the open source gateway, or what happens to existing pricing.
Silence isn't a reason to migrate this week. It is a reason to keep your setup portable. Any of these gateways speaks the OpenAI API shape, so switching should be a config change rather than a rewrite, and it stays that way only if you don't build against one vendor's proprietary features. The LiteLLM, Portkey and Cloudflare comparison goes deeper on the feature differences.
The Pick
Start managed. Start with Cloudflare AI Gateway, because free and operated by someone else beats €4 and operated by you, and it takes one line of code to put in front of your existing calls.
Move to Portkey or Helicone when you want better logging and search than the free tier gives you, somewhere around the point where you're debugging customer complaints weekly rather than monthly.
Self-host LiteLLM when a constraint forces it. Compliance, air-gap, or routing you can't buy. Not to save money, because you won't.
And whichever you run, set the spend caps on day one. A gateway without budgets is just a faster way to discover what a runaway agent loop costs overnight, and configure the fallbacks too, because September 3 will happen again. The OpenRouter alternatives roundup covers who to fall back to.
Frequently Asked Questions
Is LiteLLM free to use?
The open source proxy is free forever and covers 100 plus providers, virtual keys, teams, spend tracking, budgets, rate limits, fallbacks, request logging and Prometheus metrics. You pay for the server it runs on. LiteLLM Enterprise adds SSO, SCIM, audit logs, secret manager integration and 24/7 support, priced on annual request capacity rather than per token, and not published publicly.
How much does a managed AI gateway cost?
Less than most people expect. Cloudflare AI Gateway core features are free on every plan. Portkey has a free Developer tier with 10,000 logs a month and charges $49 a month for 100,000. Helicone gives 10,000 requests a month free and charges $79 a month for Pro. For a solo builder, the managed option is often cheaper than self-hosting once your own time counts.
Does an AI gateway slow down my requests?
It adds a hop, so yes, a little. That matters far less than what a gateway prevents. On September 3, 2026, ChatGPT, Claude and Grok all had outages in the same window, with Claude down for three hours and six minutes. An app calling one provider directly was down for all of it. A gateway with fallbacks configured was not.
When should I self-host LiteLLM instead of buying a gateway?
When you need data residency or an air-gapped deployment, when your routing logic is unusual enough that no hosted product expresses it, or when your log volume makes per-log pricing worse than running a server. Compliance requirements are the most common honest reason. Saving money is the most common wrong one at small scale.
What happened to Portkey after the Palo Alto Networks acquisition?
Palo Alto Networks completed its acquisition of Portkey on May 29, 2026, and Portkey now sits inside Prisma AIRS as the AI Gateway for agent security. The press release says nothing about the standalone product, the open source gateway or existing customer pricing. That silence is a reason to keep your configuration portable, not a reason to leave today.
Get honest tool comparisons in your inbox
Join 50+ indie hackers and solo developers who get new comparisons, pricing changes, and tool picks. No spam. Unsubscribe anytime.
Related Articles
Best Hugging Face Inference Alternatives for Indie Hackers in 2026
Nvidia agreed to buy Hugging Face for $12.93 billion. The dedicated endpoint pri...
Best OpenRouter Alternatives for Indie Hackers in 2026
Stripe is buying OpenRouter and nobody has promised your API or pricing survives...
Best Metabase Alternatives for Indie Hackers in 2026
Three different picks if Metabase isn't working out, none of them Grafana or Sup...