Comparing the 5 Best LLM Gateways for Routing, Cost Control, & Security

2026-12-04来源 dev.toEnglish
Comparing the 5 Best LLM Gateways for Routing, Cost Control, & Security

LiteLLM, OpenRouter, and Cloudflare AI Gateway are the three LLM gateways I would shortlist first. Kong AI Gateway and Portkey fit more specific setups, mainly teams that already run Kong or want a security-led platform. The ranking rests on three jobs a gateway has to do: route requests across models, keep spend under control, and keep sensitive data out of prompts and logs.

This comparison draws on each product's own documentation and pricing pages as of December 2026. Those pages describe what a product offers, not how well it performs, so the article does not rank anything on speed or uptime. Where a page gives no number, the article says so.

Key points

  • LiteLLM: Self-hosted, MIT license, per-key budgets and rate limits across 100+ providers.
  • OpenRouter: Hosted, 700+ models, list-price inference plus a 5.5% fee on Standard credit purchases.
  • Cloudflare AI Gateway: Analytics, caching and rate limiting are free on all plans.
  • Kong AI Gateway: PII redaction across 20 categories and 9 languages, best for teams already running Kong.
  • Portkey: Now part of Palo Alto Networks' Prisma AIRS, so confirm current pricing and open-source status.

What an LLM gateway does

An LLM gateway sits between your application and the model providers, so your code calls one API instead of one per provider. Once every request passes through one place, you can add the controls that are painful to build into each service separately.

In practice, the controls fall into three groups:

  • Routing: Send a request to a chosen model, spread load across deployments, and fall back to another model or provider when one fails.
  • Cost control: Issue keys with budgets and rate limits, cache repeated requests, and see spend by team or project.
  • Security: Filter or redact sensitive data in prompts and responses, and keep logs for audit.

The five gateways below cover all three groups, but they weight them differently.

How I picked

The comparison uses five criteria, each checked against the vendor's own documentation.

Criterion What we checked
Routing and reliability Provider coverage, load balancing, fallbacks and retries
Cost control Budgets, rate limits, caching and spend visibility
Security and data handling Guardrails, PII or DLP controls, retention options
Deployment and licensing Self-hosted or hosted, open source or commercial
Pricing transparency Whether the page states fees and plan limits

A capability the page does not mention is reported as not stated, not as missing. No gateway was load-tested for this article.

The five LLM gateways at a glance

The table summarizes what each vendor's documentation says. Details and limits follow in each section.

Gateway How you run it Routing Cost control Security
LiteLLM Self-hosted, MIT license Load balancing, fallbacks, retries across 100+ providers Virtual keys with budgets and rate limits, spend by key, team, user and tag Content filters and PII masking, SSO and audit logs on Enterprise
OpenRouter Hosted Auto-routing and fallbacks across 700+ models List-price inference plus a 5.5% fee on credit purchases (Standard) Zero Data Retention routing on every plan, data-policy routing on paid plans
Cloudflare AI Gateway Hosted on Cloudflare Dynamic routes with conditional flows, fallbacks Caching and rate limiting free on all plans Guardrails and DLP scanning
Kong AI Gateway Self-hosted or Konnect Provider-agnostic API, round-robin and lowest-latency balancing Semantic caching and an AI rate limiting plugin PII redaction in 20 categories and 9 languages, prompt guard
Portkey Open-source gateway plus hosted, now owned by Palo Alto Networks Fallbacks and weighted load balancing Response caching, semantic caching in hosted and enterprise versions 40+ pre-built guardrails

The 5 best LLM gateways

1. LiteLLM

LiteLLM is an open-source gateway, linked to an MIT license on its docs site, that supports 100+ LLM providers. Its strength is governance: every key carries its own models, budgets and rate limits, and every request is logged with its cost.

  • Routing: Load balancing, fallbacks and retries move traffic between deployments when a provider has a problem.
  • Controls: Virtual keys can be issued to users, teams and projects.
  • Cost visibility: Spend is broken down by key, team, user and tag.
  • Security: Content filters, PII masking and policies apply to requests and responses.
  • Observability: Logs and metrics can go to Langfuse, Datadog, OpenTelemetry and Prometheus.

Not ideal if:

  • You do not want to host and maintain a gateway yourself.
  • You need SSO or audit logs. The docs list both under the Enterprise tier, and that list overlaps with features described for the core product, so verify before committing.

Best for: Teams that want to self-host the gateway and control budgets per key.

Pricing: The software is open source. The docs page gives no Enterprise price.

2. OpenRouter

OpenRouter is a hosted service. The Standard plan lists 700+ models with no minimums or lock-in, and inference is billed at the provider's list price on every plan. OpenRouter earns its money through a platform fee on credit purchases instead.

  • Routing: Auto-routing and preferred vendors are included on the paid plans, and routing can try alternative models when a provider is down.
  • Reliability: Under Zero Completion Insurance, failed attempts are not charged for model tokens.
  • Data handling: Zero Data Retention routing is available on every plan, and data-policy-based routing is on the paid plans.
  • Bring your own keys: The first $25,000 of list-price inference each month carries no OpenRouter fee on Standard and Business, then 5% of list price.

Not ideal if:

  • You want to avoid a platform fee. It is 5.5% on Standard and 8% on Business.
  • You need per-team budgets. The pricing page does not describe them.
  • You do not want prompts to pass through a third party.

Best for: Teams that want one hosted API and key for many models, with nothing to deploy.

Pricing: Free (25+ free models, 50 requests per day), Standard at 5.5%, Business at 8%, and Enterprise with contract pricing.

3. Cloudflare AI Gateway

Cloudflare AI Gateway has a free tier for its core features. Per its pricing page, the gateway is available on all plans, and dashboard analytics, caching, and rate limiting are free.

  • Routing: Dynamic routes handle conditional flows with percentage-based traffic splits and rate and budget limits, plus fallbacks when a model is unavailable.
  • Cost control: Identical requests can be served from Cloudflare's cache.
  • Security: Guardrails check prompts and responses for harmful content, and DLP scans for PII and financial data.
  • DLP: Free on all plans with two predefined profiles, unless you have a Zero Trust subscription.

Not ideal if:

  • You want to stay off Cloudflare's platform.
  • You plan heavy guardrail use, since guardrails are billed as Workers AI token-based inference.
  • You need to pay by anything but credit card, since Unified Billing accepts only cards.

Best for: Teams already on Cloudflare that want free caching, rate limiting, and DLP.

Pricing: core features are free. Unified Billing adds a 5% fee on credits, so a $100 purchase costs $105. Gateways created before September 24, 2026, keep legacy log limits of 100,000 logs on Workers Free and 10,000,000 per gateway on Workers Paid, while newer gateways follow Workers Logs pricing.

4. Kong AI Gateway

Kong AI Gateway is built on Kong Gateway, and its AI plugins work in all deployment modes, including self-hosted, hybrid, DB-less, Kubernetes and Konnect. For a team that already operates Kong, it is the natural extension.

  • Routing: A provider-agnostic API, with listed providers including OpenAI, Anthropic, and Azure AI. The balancer supports round-robin and lowest-latency.
  • Cost control: The AI Semantic Cache plugin caches LLM responses, and the AI Rate Limiting Advanced plugin manages traffic to your LLM API.
  • Security: Automatic detection and redaction of sensitive data across 20 categories and 9 languages, plus an AI Prompt Guard plugin with allow and deny lists.
  • Observability: Token usage, latency, and cost through audit logs and metrics exporters.
  • Agents: An MCP traffic gateway for agent infrastructure.

Not ideal if:

  • You do not already run Kong and want something lightweight.
  • You need clear pricing or edition details. The overview page gives neither.
  • You need token-based rate limits. The page does not say whether the limits count tokens.

Best for: Platform teams that already run Kong for their APIs.

Pricing: Not stated on the overview page, so confirm licensing with Kong.

5. Portkey

Palo Alto Networks announced on May 29, 2026, that it closed its acquisition of Portkey and described Portkey as the core AI Gateway for its Prisma AIRS security platform. The Portkey gateway repository is listed under an MIT license.

  • Routing: Fallbacks to another provider or model on failed requests, and weighted load balancing across keys or providers.
  • Cost control: Response caching, with semantic caching marked as available only in hosted and enterprise versions.
  • Security: 40+ pre-built guardrails for input and output checks.

Not ideal if:

  • You need the open-source gateway's future guaranteed. The acquisition announcement does not mention it.
  • You rely on its model count. The repository gives 1,600+ in the description and 250+ in the README.
  • You rely on its "<1ms latency" claim, but it includes no benchmark.

Best for: Teams that want a gateway tied to a security platform and can confirm its current terms.

Pricing: Not verified. Portkey's pricing page now redirects to a Palo Alto Networks page that I could not open.

Recent changes in the LLM gateway market

  • Palo Alto Networks closed its acquisition of Portkey on May 29, 2026, and positions it as the core gateway of Prisma AIRS.
  • Cloudflare changed AI Gateway logging for gateways created on or after September 24, 2026, which now follow Workers Logs pricing instead of the legacy limits.

How to choose

Start from the constraint that is hardest to change, which is usually where the gateway runs and who owns the data path.

If you need Start with
Full control, self-hosting and per-team budgets LiteLLM
One hosted API and key for many models, no infrastructure OpenRouter
Free caching, rate limiting and DLP, and you already use Cloudflare Cloudflare AI Gateway
An extension of an existing Kong deployment Kong AI Gateway
A gateway tied to a security platform Portkey

Whichever you shortlist, send a week of your own traffic through it before you commit. Measure the latency it adds, the cost per successful request including fees, and how it behaves when you force a provider failure.

What to check before choosing

Beyond the feature comparison, work through these before putting a gateway into production.

1. Understand where your data goes.

A gateway makes model access easier, but it does not make your data private. Check how requests are processed, whether prompts and responses are logged, who receives the data, and what retention controls exist. Review this before going live with customer data or internal documents.

2. Test routing with real workloads.

A gateway that handles a basic chatbot may behave differently with streaming responses, agent workflows, or retrieval-augmented generation. Send a week of your own traffic through it and watch response consistency, latency, provider compatibility, and error handling.

3. Check fallback behavior.

Ask what happens when a model is unavailable, rate-limited, or slow. Failing over to another provider can improve reliability but may change response quality, latency, or cost. Force a provider failure in testing so you know the trade-offs before enabling automatic failover.

4. Look beyond basic cost tracking.

Token usage is only one part of spend. Consider model pricing, caching opportunities, the cost of unnecessary retries, request volume, platform fees, and the cost of using a powerful model for a job a simpler one could do. Measure cost per successful request, including fees. A good gateway helps you understand spending patterns, not just give you a total.

5. Understand operational responsibility.

A self-hosted gateway gives you control but also the maintenance. A managed gateway reduces ops work, but you need to review its deployment model, data handling, availability, and configuration options. These usually matter more than the number of supported providers.

Conclusion

An LLM gateway is more than a convenient way to connect model APIs. As your application grows, it becomes the control plane for routing, cost, security, and reliability.

LiteLLM suits teams that want to self-host with full control. OpenRouter suits teams that want one hosted API and the widest model choice. Cloudflare AI Gateway suits teams already on its platform. Kong fits organizations with existing API management, and Portkey fits those who want a security-platform-backed gateway, once its pricing and open-source status are confirmed.

There is no universal winner. A tiny app on a single model can do without a gateway. But as providers multiply, traffic grows, and cost becomes unpredictable, the gateway stops being optional.

Frequently Asked Questions

What is an LLM gateway?

It is a layer between your application and model providers. Your code calls one API, and the gateway handles routing, fallbacks, budgets, caching, guardrails, and logging.

Which LLM gateway is best?

LiteLLM, OpenRouter, and Cloudflare AI Gateway are the best LLM gateways. LiteLLM suits self-hosting, OpenRouter suits a single hosted API, and Cloudflare suits teams already on its platform.

Is LiteLLM free?

The gateway is open source and licensed under MIT. Its docs also describe an Enterprise tier that adds SSO/SAML, audit logs, spend tracking, multi-team management and guardrails. The docs give no price.

Does OpenRouter add a markup to model prices?

Its pricing page says inference is billed at the provider's list price on every plan. It charges a platform fee on credit purchases instead: 5.5% on Standard and 8% on Business.

Is Cloudflare AI Gateway free?

Core features, which are dashboard analytics, caching and rate limiting, are free on all plans. Guardrails, Unified Billing and Logpush carry separate charges.

Can a gateway protect sensitive data?

Several can filter or redact it. Cloudflare offers DLP scanning, Kong lists PII redaction across 20 categories, and LiteLLM lists PII masking. Test the detection on your own data, because the vendor pages do not give accuracy figures.

原文:https://www.a8q9.cn/en/article/comparing-the-5-best-llm-gateways-for-routing-cost-control-security-82df98.html

相关文章