Build vs Buy

Self-Hosted AI Gateway vs. SaaS: The Real Build vs. Buy Math

Open-source AI gateways now match SaaS on features. The decision comes down to who owns the ops, the governance, and the cost curve as you scale.

At a glance
  1. 01Self-hosted AI gateways are free to license but can cost $500 to $8,000 monthly in infrastructure and labor.
  2. 02Managed SaaS gateways offer faster performance, with Kong processing requests up to 859% faster than LiteLLM.
  3. 03Less than 1% of enterprise AI traffic has governance controls, leaving most prompts completely unmonitored.
  4. 04Self-hosting inference behind a gateway only pays off at massive scale, typically above 100 million tokens.
A central routing manifold directing identically shaped blank tokens into three different geometric output channels, representing an AI gateway managing API requests.
Illustration generated by Remy for this story.

A self-hosted AI gateway (LiteLLM, Portkey OSS, Bifrost, Kong) is free to license and gives you full control over routing, but it dumps infrastructure, uptime, and DevOps labor onto your team. A managed SaaS gateway (Portkey Pro, OpenRouter, Kong Konnect) charges a monthly fee and takes that labor off your plate, at the cost of usage-based billing and some vendor lock-in. Neither wins outright. The right call depends on your request volume, your governance requirements, and how much ops capacity you want to spend on plumbing instead of product.

What does an AI gateway actually do?

Any team running more than one model in production needs a layer between the application and the LLM providers. That's the AI gateway. It typically handles:

  • Unified API access. One interface instead of separate integrations for OpenAI, Anthropic, Google, and open-weight models.
  • Failover and routing. Automatic rerouting when a provider rate-limits or goes down.
  • Cost tracking. Per-request, per-team, or per-model spend visibility.
  • Observability. Logs, latency metrics, and traces across every model call.
  • Guardrails. Prompt filtering, PII redaction, and policy enforcement before a request leaves the building.

Once a company runs more than one model in production, this layer stops being optional. Kong's data shows 62% of organizations on its AI Gateway already run two or more models simultaneously, and 20% run six or more.1 The gateway isn't a nice-to-have anymore. It's plumbing.

The two paths: self-hosted open source vs. managed SaaS

On one side: the open-source stack. LiteLLM, Portkey's open-source core, Bifrost, and Kong's self-managed AI Gateway. You run the code, you own the servers, and you pay nothing for the license.

On the other side: the managed layer. Portkey Pro and Enterprise, OpenRouter, TrueFoundry, and Kong Konnect. You pay a subscription, and the vendor runs the infrastructure, the upgrades, and the on-call rotation.

It's a straightforward Build vs. Buy decision, the same one that shows up across open-source data infrastructure and internal AI agent workflows. The gateway layer is just the latest place it's landed.

Has open source caught up on features and performance?

Mostly, yes, on features. Performance is a different story.

OpenRouter's own comparison shows LiteLLM covering 2,500+ models across 100+ providers for free at the OSS tier, with Portkey close behind at 1,600+ models and 250+ providers, plus built-in HIPAA, SOC2, and ISO27001 compliance tooling that LiteLLM doesn't ship out of the box.2 Feature parity is close enough that most teams won't hit a capability wall picking either one.

Figure 1
Model and provider coverage by gateway
LiteLLM2,500Portkey1,600OpenRouter400
Source: OpenRouter

Performance is where the gap shows. In a head-to-head benchmark under identical 12-CPU allocations with no policies enabled, Kong's Konnect data planes processed requests 228% faster than Portkey OSS and 859% faster than LiteLLM, with 65% and 86% lower p95/p99 latency respectively.3 That's not a knock on LiteLLM's functionality. It's a reminder that free software still carries an engineering cost: tuning a self-hosted gateway for throughput takes real work a managed platform has already done for you.

Figure 2
Kong benchmark: self-hosted gateway performance gap
228%
Faster than Portkey OSS (Kong Konnect, 12 CPUs)
859%
Faster than LiteLLM (Kong Konnect, 12 CPUs)
Source: Kong Inc.

Sticker price vs. total cost of ownership

Most teams get this math wrong. They compare LiteLLM's $0 license fee to Portkey's $49/month sticker price and conclude self-hosting is free money. It isn't.

A realistic self-hosted LiteLLM deployment, once you add Postgres, Redis, load balancing, and roughly 20% of a DevOps engineer's time, runs $500 to $2,500 a month, climbing to $3,000-$8,000 a month at enterprise scale above 10 million requests monthly.4 Compare that to Portkey Pro at a flat $49/month for unlimited logs, or its usage-based tiers scaling from a free 10K-log Dev plan upward.5 Kong Konnect Plus starts at $25/month per control plane, but a real production deployment with data planes, Postgres, and Kong-specific expertise runs an estimated $575-$1,425/month.4 The same pattern shows up in general-purpose API gateways too: self-hosting can run $50,000+ a year in infrastructure and engineering time, versus roughly $30,000 a year for a fully managed, production-ready gateway.6

Figure 3
Monthly cost: self-hosted LiteLLM vs. managed gateways
estimated monthly cost (USD)
$49.00Portkey Pro (flat)$1,000Kong Konnect (real deployment)$1,500Self-hosted LiteLLM (typical)$5,500Self-hosted LiteLLM (enterprise scale)
Ranges are midpoints of the cited estimates ($575-$1,425 for Kong, $500-$2,500 for typical self-hosted LiteLLM, $3,000-$8,000 for enterprise-scale self-hosted).
Source: Turion.ai

The license is free. The operation isn't. That gap is the entire TCO argument, and it's the same one covered in the API trap piece on cloud cost overruns driving self-hosting: the sticker price and the total cost of ownership are two different numbers, and only one of them shows up on the vendor's pricing page.

When does self-hosting the gateway pay off?

The break-even point isn't about the gateway alone. It's about the volume flowing through it and what sits behind it.

  • Under 5-10 million tokens/month. Stick with a managed gateway and commercial APIs. Hidden engineering, monitoring, and compliance costs routinely erase any savings below this threshold.7
  • Above 100 million tokens/month. Self-hosting the inference layer behind your gateway can save $5M-$50M annually.7 One Fortune 500 legal-document case study replaced $1.05M/month in Claude Sonnet API spend with a self-hosted 8xH100 cluster running Llama 3.1 405B, cutting costs 75% and saving $9.4M a year with a 4.5-month payback.7
  • DevOps capacity. Without engineers who can own Postgres, Redis, and load balancer tuning as a standing responsibility, the $500-$2,500/month self-hosted estimate will run higher in practice.4
  • Data sovereignty. If prompts and responses can't leave your infrastructure for legal or contractual reasons, self-hosting stops being optional regardless of the cost math.
  • Existing platform standardization. If you're already running Kong for API management, adding its AI Gateway plugin is a much smaller lift than adopting Kong from zero just for AI routing.4
Figure 4
Self-hosted inference payoff at scale
$9.4M
Annual savings from self-hosting inference layer
4.5 months
Payback period
75%
Cost reduction vs. Claude Sonnet API spend

The governance wildcard

Cost math assumes you're optimizing for price. Often you're actually optimizing for control, and that changes the calculus entirely.

Across organizations running AI traffic through Kong, less than 1% have any AI-specific governance controls in place: no prompt guards, no request or response filtering, no route-level policy.1 Meanwhile 97.8% of enterprise AI requests go straight to third-party proprietary APIs, meaning prompts and data leave the company's perimeter with essentially no oversight.1 Enterprise AI traffic through Kong grew 7x as a share of total platform traffic in nine months.1 The volume is arriving faster than the governance is.

Figure 5
Governance gap in enterprise AI traffic
<1%
Of orgs on Kong have AI-specific governance controls
97.8%
Of enterprise AI requests go straight to third-party APIs
7×
Growth in AI traffic share on Kong platforms in 9 months
Source: Kong Inc.

This is the same shadow-AI pattern covered in the shadow AI tech stack piece and the rules for AI-generated code security: employees and teams route around whatever infrastructure doesn't exist yet. A gateway, self-hosted or SaaS, is what turns ungoverned AI traffic into traffic you can actually see and control. If your real problem is that nobody knows where prompts are going, buying a managed gateway with built-in guardrails might solve that faster than building your own policy layer from scratch. If the problem is that those controls need to live entirely inside your own perimeter for compliance reasons, self-hosting is the only real answer.

Decision framework: build, buy, or hybrid

  • Self-host if: you're above the 5-10 million token/month threshold, you already have DevOps capacity to own Postgres/Redis/load balancing, and data sovereignty or vendor lock-in avoidance matters more than convenience.47
  • Buy managed SaaS if: you're under that volume threshold, you lack dedicated ops headcount, or you need compliance certifications (HIPAA, SOC2, ISO27001) out of the box rather than built in-house.27
  • Go hybrid if: you self-host the inference layer for cost control at scale but keep a lightweight managed gateway in front for governance, observability, and multi-provider failover, capturing the savings of ownership without rebuilding every guardrail from scratch.
Figure 6
Self-hosted vs. managed AI gateway: decision matrix
Self-hosted vs. managed AI gateway: decision matrix
License CostOps BurdenRaw PerformanceCompliance Built-InData Sovereignty Control
Self-hosted OSS (LiteLLM, Portkey OSS, Kong self-managed)high-volume teams with dedicated DevOps and sovereignty needs$0HighMediumNoHigh
RecommendedManaged SaaS (Portkey Pro, OpenRouter, Kong Konnect)teams under 5-10M tokens/month without dedicated ops headcount$49-$2,500/moLowHighYesMedium
Hybrid (self-hosted inference + managed gateway)scale-stage teams wanting cost control with governance intactMixedMediumHighYesHigh
Ratings are relative across these options, not absolute. License cost figures and performance are drawn from cited sources; ops burden, compliance, and data-control ratings are Remy analysis.
Source: Remy analysis

Treat the gateway the way you'd treat any other piece of infrastructure you're deciding whether to rent or own: as an asset with a real total cost, not a line item you can eyeball from a pricing page. The license fee tells you almost nothing. The ops bill, the governance gap, and your actual token volume tell you everything. Teams evaluating this trade-off for their own agent and application infrastructure, including platforms like Remy, are increasingly finding that the real decision point isn't capability parity anymore. It's whether you want to own the operational curve or pay someone else to own it for you.

Frequently asked
Questions readers ask
Is a self-hosted AI gateway cheaper than a SaaS AI gateway?

Only above a certain volume. Below roughly 5-10 million tokens/month, hidden infrastructure and DevOps costs (often $500-$2,500/month for a self-hosted LiteLLM setup) usually cost more than a managed plan like Portkey Pro at $49/month. Above that threshold, self-hosting can save significantly, sometimes millions annually at enterprise scale.

Which is faster, LiteLLM, Portkey OSS, or Kong AI Gateway?

In a controlled benchmark with identical CPU allocations and no policies enabled, Kong's data planes processed requests 228% faster than Portkey OSS and 859% faster than LiteLLM, with substantially lower p95/p99 latency. Feature coverage across the three is close, but raw throughput favors Kong.

What's the real cost of self-hosting LiteLLM in production?

The code is free under MIT license, but a realistic production deployment with Postgres, Redis, load balancing, and DevOps time runs $500-$2,500/month at moderate scale and $3,000-$8,000/month at enterprise volume above 10 million requests monthly.

Why would a company choose a managed AI gateway over self-hosting?

Speed to production, built-in compliance certifications (HIPAA, SOC2, ISO27001 in Portkey's case), no DevOps overhead, and avoiding the ops burden of running Postgres, Redis, and load balancers yourself. It's the classic buy-side trade of convenience for a recurring fee.

Does using an AI gateway solve shadow AI governance problems?

It helps but doesn't automatically solve it. Less than 1% of enterprises running AI traffic through Kong have AI-specific governance controls in place, and 97.8% of requests go to third-party APIs with no oversight. A gateway, self-hosted or SaaS, is the mechanism that makes governance possible, but someone still has to configure and enforce the policies.

Sources
  1. 1A New Dawn: Enterprise AI's Shadow — Trillions of Tokens, Zero GovernanceKong Inc.
  2. 2What Is an LLM Gateway? The Missing Layer Between Your App and AI ModelsOpenRouter
  3. 3AI Gateway Benchmark: Kong AI Gateway, Portkey, and LiteLLMKong Inc.
  4. 4LiteLLM vs Portkey vs Kong: LLM Gateway Pricing — June 2026Turion.ai
  5. 5Feature Comparison — Portkey Open Source vs Dev/Pro/EnterprisePortkey (docs)
  6. 6Total Cost of Ownership: Managed vs Self-Hosted API GatewayGravitee
  7. 7Self-Hosting AI Models vs API Pricing: Complete Cost Analysis (2026)AI Pricing Master
Portrait of Dana Whitfield
Dana Whitfield
SaaS Economics
Dana breaks down where software budgets actually go, one line item at a time.
More from Dana Whitfield
© 2026 The Official Remy BlogDrafted by AI authors, reviewed by human editors.