ASCENDING Blog Home
Jarvis AI
Cloud Services
Talent Solutions
Public Sector
About

LLM Gateway Explained: What It Controls and When You Need One

Read Time: 13 min read Publish Date:

Arjun Vijay portrait

Arjun Vijay

Contributing Writer · Agent Frameworks

Share on LinkedIn
On this page
Concept card showing applications sending model requests through one LLM gateway that applies limits, routing and logging before the requests reach several model providers

An LLM gateway is a shared layer between your applications and model providers. Applications send requests to one endpoint, and the gateway applies your rules before it calls a provider.

Multi-model use is already common. In a16z’s 2025 survey, 37% of the 100 CIOs said they used five or more models, versus 29% the year before (a16z, June 2025). Models from different providers each bring their own key, invoice and log format.

A gateway pulls those into one place. It also concentrates risk. In 2026, LiteLLM, which Wiz calls one of the most popular open-source LLM gateways, had two supply-chain incidents involving malicious releases. A security firm also found public instances running on a default key or with no authentication. We cover that evidence below.

This guide is for AI leaders and platform teams at mid-sized companies. It explains how a gateway works, what it solves, where to run it, what it adds in risk and when to skip one. Tool access through MCP is a separate path. For that comparison, see MCP gateway vs LLM gateway.

Last verified: November 30, 2026. Vendor documentation, cloud guidance and security reports linked below were read between November 24 and 30.

Key Takeaways

  • An LLM gateway controls the model request path: one endpoint, central provider keys, and shared limits, routing and logs. It doesn’t govern tools or agents.
  • Gateways differ by product. Check which controls your product documents, such as budgets, fallbacks and guardrails, instead of relying on the name.
  • The gateway holds every provider key, so it becomes a high-value target. Pin versions, remove default keys, limit egress and give each app its own key.
  • One app on one provider rarely needs a standalone gateway. Add one when keys, spend or model changes spread across teams.

Disclosure: ASCENDING builds Jarvis, an open source project that includes an MCP registry and gateway. We found no application-facing model-routing feature in its documentation, so the product facts below come from each vendor’s own pages.

What is an LLM gateway?

An LLM gateway receives model requests from your applications and forwards them to providers while enforcing your rules. The application sees a single API, and the gateway handles the many providers behind it.

Vendors define it in similar terms. LiteLLM offers one OpenAI-compatible endpoint in front of 100+ providers. Cloudflare describes its gateway as visibility and control over your AI apps. Microsoft says its AI gateway capabilities extend API Management’s existing API gateway and aren’t a separate offering (Microsoft Learn).

Claude Code’s docs list what a gateway gives a company. Provider keys stay on the server. Usage is tracked by developer or team. Budgets and rate limits apply in one place. Audit logs and provider switching live in configuration (Claude Code docs).

Three traits define the category:

  • One endpoint. Many gateways accept the OpenAI chat completions format. That’s a de facto convention, not a formal standard. Some products also accept the OpenAI Responses and Anthropic Messages formats, including Vercel AI Gateway and, on its v2 tiers, Azure API Management.
  • Central keys. Applications hold a gateway credential. Provider keys stay in the gateway.
  • Shared policy. Limits, routing, guardrails and logs apply to every call, not app by app.

An LLM gateway isn’t a model, and it isn’t an agent framework. It also doesn’t govern which tools an agent can reach. That’s the job of an MCP gateway.

How a request moves through an LLM gateway

A request passes through a sequence of checks before it reaches a provider, and the response passes through metering on the way back. Products differ in which stages they offer. The sequence below is illustrative, not any one product’s implementation.

Diagram of a model request crossing an LLM gateway: authentication, limits and guardrails, cache check, routing with fallback, then metering, logging and the response

Illustrative request path. Stage names and order vary by product.

  1. Authenticate. The gateway identifies the caller by a gateway key or an identity token.
  2. Check limits. It tests the request against rate limits and budgets. A request that fails is rejected before it uses tokens.
  3. Apply input guardrails. It can redact personal data or block content before the prompt leaves your boundary.
  4. Check the cache. An exact or semantic cache can answer without calling a provider.
  5. Route. It picks a provider and deployment by rule, cost, latency or health.
  6. Call and recover. It translates the request into the provider’s format, then retries or falls back on failure.
  7. Filter and meter. It applies output guardrails, counts tokens and calculates cost.
  8. Log and return. It records request metadata and returns the response in the format the application expects.

What happens when a provider fails?

Several gateways document retries, fallbacks and circuit breakers. Portkey documents all three. Azure API Management documents a load balancer with a circuit breaker. Cloudflare documents retries and model fallback.

Fallback has a trade-off. A different model can change output quality, format or cost. Test fallback paths on real tasks before you enable them. That takes test time, but it catches quality and format surprises early. Switching AI models without rebuilding apps covers a small acceptance test.

The problems an LLM gateway solves

A gateway addresses six problems. Which fixes you get depends on the product, edition and configuration.

ProblemWhat the gateway addsDocumented examplesOWASP item (our mapping)
One loop or one user runs up spendBudgets, token limits and rate limitsAzure llm-token-limit; LiteLLM max_budget, tpm_limit and rpm_limit; Kong token quotas by consumer group; Vercel budgetsLLM10 Unbounded Consumption
A provider outage stops a featureRouting, retries and fallbackCloudflare model fallback; Vercel provider failover; Portkey circuit breakersNone
Secrets are scattered across appsCentral provider credentials and per-app keysLiteLLM virtual keys; Portkey’s Model Catalog; Vercel centralized credentialsNone
Sensitive data or unsafe content crosses your boundaryInput and output guardrailsKong AI Sanitizer and prompt guard; Azure AI Content Safety; LiteLLM guardrailsLLM01 Prompt Injection, LLM02 Sensitive Information Disclosure, LLM05 Improper Output Handling
Nobody can say who spent whatRequest, token and cost logs by key, team or userCloudflare analytics; LiteLLM spend by key, team and user; Vercel request logsSupports review of LLM10
Repeated prompts are paid for twiceExact or semantic cachingAzure semantic caching; Vercel prompt caching; Cloudflare cachingNone

We read each vendor page named here between November 24 and 30, 2026, and recorded only what the page states. We checked each cited claim against its source page. We didn’t test the products. A documented control says nothing about depth, licensing or which tier includes it. The sources are the vendor pages for LiteLLM virtual keys, Kong AI Gateway, Portkey, Cloudflare, Vercel and Azure.

The OWASP column maps each problem to the OWASP Top 10 for LLM Applications 2025. That mapping is ours. OWASP didn’t write it.

Spend limits address a named risk. OWASP’s Unbounded Consumption entry lists rate limiting and quotas as mitigations and describes “Denial of Wallet” attacks. Keep provider-side quotas as a second line, because the gateway is one layer. To attribute spend by team, follow the method in AI token cost tracking by users, teams and budgets.

Guardrails need the same layering. A gateway filter helps with prompt injection, but treat it as one control among several, and keep application-level checks too.

LLM gateway, AI gateway, LLM proxy and API gateway: what’s the difference?

The labels overlap, so judge a product by the traffic types and controls it documents, not by its label.

LabelWhat it usually meansWhat to ask
LLM gatewayControls model traffic from your applications to providersWhich providers, controls and API formats are documented?
AI gatewayA broader label, defined belowWhich traffic types does the documentation name?
LLM proxyOften the same thing. OpenRouter, itself a gateway vendor, calls the terms effectively interchangeable, with a proxy implying simpler pass-throughWhich controls does it add beyond forwarding?
API gatewayGeneral HTTP traffic: authentication, rate limits, routing. OpenRouter notes it has no understanding of tokens, model capabilities or inference costDoes it offer token-aware limits or AI plugins?

Some products also use “LLM Gateway” as a product name, such as LangSmith’s LLM Gateway. The category is consolidating too. Palo Alto Networks completed its acquisition of Portkey on May 29, 2026, and describes Portkey as the AI Gateway for its Prisma AIRS platform (Palo Alto Networks). If you shortlist a gateway, check who owns it and what its current terms say.

An AI gateway is the broader label. Some products cover only model traffic, and others add MCP tools and agent-to-agent calls. An LLM proxy is usually the same layer with a lighter feature set, though vendors use the word loosely.

For the API-gateway comparison, see agent gateway vs API gateway.

Four ways to run an LLM gateway

You can run one four ways. Each trades control against operating work.

PatternWhat it gives youTrade-offExamples
Library in your appNo extra service to run; one code interface across providersLimits, keys and logs stay inside each app, so central policy is weakLiteLLM Python SDK
Self-hosted proxyControl of the data path and keysYou patch, scale and secure it, and run its databaseLiteLLM proxy; Portkey’s open source gateway
Managed gatewayThe least operating workPrompts and responses pass through another vendor; check its data-handling termsVercel AI Gateway, Cloudflare AI Gateway, OpenRouter
Cloud-platform gatewayFits your existing identity, billing and monitoringTies policy to one cloud’s tooling and supported modelsAzure API Management AI gateway

The self-hosted row hides real work. AWS’s reference design for a self-service gateway shows the load. LiteLLM runs on Fargate, with a PostgreSQL database for virtual-key and spend state. A Valkey cache also coordinates rate limits across tasks. Secrets Manager holds credentials, and a scoped IAM role makes the Bedrock calls (AWS Machine Learning Blog). That’s a service to build, secure and monitor.

On AWS, a lighter option is direct Bedrock access. AWS calls it the lowest-complexity choice when native AWS identity, IAM policies and CloudTrail logs meet your needs (AWS Machine Learning Blog). Bedrock’s cross-Region inference adds routing across Regions. AWS advises adding retries and fallback in your own application. See Bedrock inference profiles for the details.

Our rule of thumb for a company of 100 to 1,000 people with a few AI applications: start with a managed or cloud-platform gateway. The vendor takes on patching, but your prompts pass through its service or your policy ties to one cloud. Choose a self-hosted proxy when data control or a private network requirement outweighs the operating work described next.

What risks does the gateway itself add?

A gateway concentrates every provider key and prompt in one place. That makes it a single point of failure and a high-value target.

Availability and latency

A gateway adds a network hop and a service that can go down. Aptible, a commercial vendor, puts it plainly: the gateway sits in the critical path of every model call, so its availability becomes your availability (Aptible). HoneyHive, an observability vendor, reports one gateway vendor’s estimate of about 3 to 10 ms of overhead. That estimate has no independent test. We found no independent latency benchmark for these gateways either. Measure the overhead with your own traffic and policies. If the feature is critical, run a second instance. That costs more and needs shared state so budgets and limits stay consistent.

Concentrated credentials

A centralized proxy holds the keys for every provider it fronts. Wiz argues that AI gateways have become critical infrastructure that holds credentials for every AI provider, often with a security model reduced to a single shared secret (Wiz). The Cloud Security Alliance makes the same point about LiteLLM deployments. In our assessment, SDK use doesn’t centralize keys the same way, so the library pattern carries less of this risk.

Stored prompts and logs

Usage logs are a benefit and a liability. Depending on configuration, a gateway’s logs can hold prompts and responses, which may contain personal or confidential data. Aptible calls them your most sensitive data store. Check what each product stores, set retention and access rules, and log prompt content only where your policy allows it. The cost is harder debugging when prompts aren’t logged.

Features you give up

A gateway maps every provider to one request format. That mapping can drop provider-specific features. Aptible calls this the real cost of the pattern, and says teams usually notice it only after a migration. Before you route a workload through a gateway, list the provider features its prompts rely on. Then test them through the gateway.

Two supply-chain incidents in 2026

Security reports document two incidents involving LiteLLM. Together they involved three malicious versions. In OWASP’s terms, this is the supply chain risk.

  • March 24, 2026. Malicious litellm versions 1.82.7 and 1.82.8 reached PyPI (HiddenLayer). PyPI traces the cause to an API token exposure through an exploited Trivy dependency, and says the malware exfiltrated harvested credentials to a remote API. It reports about 2 hours 32 minutes of total exposure and over 119,000 downloads of the affected versions. It estimates that 40 to 50% of LiteLLM installs were unpinned (PyPI blog, April 2, 2026).
  • October 21, 2026. Version 1.107.0, carrying a credential stealer, was available on PyPI and in LiteLLM’s official Docker images for roughly two hours (Datadog Security Labs). LiteLLM says its release pipeline was compromised, and its own post notes that parts of its early account were later found incomplete (LiteLLM). The sources we read left the initial access route unconfirmed (Wiz).

We use LiteLLM as the example because its incidents are the ones we could verify in primary and independent reports. We didn’t audit other products, and this isn’t a ranking.

Exposed and misconfigured instances

Check Point Research found two high-risk LiteLLM flaws, CVE-2026-35029 and CVE-2026-59823. The first let any authenticated user, even a low-privileged one, change the proxy’s settings and take over administration. The second let authenticated users redirect gateway requests to their own server and capture provider keys. Both are fixed in version 1.83.9 (Check Point Research, October 2026).

In February 2026, Wiz scanned 3,074 publicly reachable LiteLLM instances visible on Shodan. It found that 9.6% accepted the default master key or required no authentication, and 6.2% required none at all (Wiz Research, September 2026). Wiz also reported a root-level code-execution flaw, CVE-2026-59821, that needs admin access. Wiz says that makes it effectively pre-auth on instances with a default key or no authentication, so an exposed admin surface is more than a billing risk.

What to do about it

These steps apply to any gateway you run yourself. Each has a cost.

  • Pin exact versions and delay upgrades. PyPI estimated that 40 to 50% of installs were unpinned, and unpinned installs fetch the newest release. Pin container image digests too. The October incident also reached floating Docker tags such as latest (Datadog, LiteLLM). The cost is slower security fixes, so keep a review path for urgent patches.
  • Never run default keys. Set your own master key, and keep the admin interface off the public internet. That means one more secret to store and rotate.
  • Limit egress. Allow the gateway to reach only the provider domains it needs. In our assessment, that would block exfiltration to an attacker’s server like the March payload’s. The price is a broken route whenever a provider adds a domain.
  • Prefer signed, verified artifacts where the project publishes them, and check them before rollout. Expect an extra release step.
  • Give each application its own key with a budget, so one leaked key has limited reach. The cost is more keys to rotate.
  • Separate admin access from application access, and patch quickly when advisories land. The cost is a second identity path to manage and an on-call duty for patches.
  • Rotate provider keys after any suspected compromise. The cost is coordinated redeploys for every app that shares a key.
  • Include the gateway in penetration tests, as you’d test a web application. Budget for test time and scope approval.

Managed gateways shift patching to the vendor, but they add vendor trust. Weigh that against your data-handling requirements, using an AI vendor risk assessment. For logging and traces, see traces, logs and metrics for AI agents.

Do you need an LLM gateway?

Add one when keys, spend or model changes start spreading across teams. Skip it for one application on one provider.

OpenRouter’s own guide says to use the direct API if you call one model from one provider and don’t plan to change, because a gateway adds operational complexity (OpenRouter). AWS makes the same point for Bedrock, as noted above.

Consider a gateway when several of these are true:

  1. You use more than one model provider, or expect to.
  2. Several teams share provider keys.
  3. You can’t say which team or application drives spend.
  4. You want to change models without redeploying applications.
  5. A policy requires redacting or blocking data before it reaches a provider.
  6. Someone needs an audit trail of model requests.

A gateway adds a hop and a system to run or buy. If an existing platform already gives you limits and logs, the gateway has to add something it doesn’t.

A gateway also only governs traffic that passes through it. In IBM’s 2025 study of 600 breached organizations, 13% reported a breach of an AI model or application, and 97% of those lacked proper AI access controls. One in five reported a breach due to shadow AI (IBM, July 2025). Those figures describe breached organizations, not all companies, and IBM measured AI access controls in general, not gateways. Pair a gateway with shadow AI discovery and an AI governance framework.

Where to start

Start with an inventory, not a product. Pull your last month of provider invoices and your list of provider keys. Count the providers, the keys and the teams behind them, then check them against the six triggers above. If two or three apply, compare two or three products on the controls from the problems table that you actually need.

Where does Jarvis fit?

One more disclosure: ASCENDING maintains the open source Jarvis project. Jarvis Registry’s public pages describe tool and agent access, not application-facing model routing. Jarvis Chat is an employee workspace. Neither replaces an LLM gateway.

If your applications need one, choose it with the checks in this guide. Running it beside Jarvis means two systems to operate. Confirm that one gateway key maps to the same user in each system’s logs. The Jarvis MCP gateway page describes the tool side. To try the pairing on one workflow, contact ASCENDING for a demo.

References

LLM gateway questions

What is an LLM gateway?

An LLM gateway is a shared layer between your applications and model providers. Applications call one endpoint, and the gateway applies your keys, limits, routing and logging before it forwards each request. It governs model traffic only, not tools or agents. See MCP gateway vs LLM gateway for the tool side.

Is an LLM gateway free?

Some are free to license, but running one still costs money. LiteLLM says its gateway is MIT-licensed and free to self-host, with an Enterprise tier that adds SSO, RBAC, audit logs and SCIM. AWS's self-service gateway reference shows the infrastructure you'd pay for: containers, a PostgreSQL database, a cache and a secrets store. We didn't review hosted gateway pricing, so compare fees and data terms directly before you choose.

What are the most popular LLM gateways?

We found no independent ranking, so we won't name a winner. The problems table in this guide covers the controls of LiteLLM, Portkey, Cloudflare AI Gateway, Vercel AI Gateway, Kong AI Gateway and Azure API Management. Wiz calls LiteLLM one of the most popular open-source options. Choose by the controls you need and how much you want to operate.

What is the difference between a gateway and an API?

A provider API is the interface one vendor exposes for its models. A traditional API gateway manages HTTP traffic to your own services and, according to OpenRouter, has no understanding of tokens, model capabilities or inference cost. An LLM gateway sits in front of several provider APIs and adds token-aware limits, provider routing and model-level logs.

Does an LLM gateway add latency?

Yes, it adds one network hop plus whatever policies you enable. We found no independent latency benchmark for the gateways in this guide. Measure the overhead with your own traffic, region and policies before you decide. The gateway also becomes one more service that must stay up.

Do I need an LLM gateway if I only use one provider?

Not necessarily. OpenRouter's own guide recommends calling the provider's API directly when you use one model from one provider and don't plan to change. A gateway starts to pay off when several teams share keys, several providers are in use, or you need central spend limits. See switching AI models without rebuilding apps for the application side.

Arjun Vijay portrait

About the author

Arjun Vijay

Contributing Writer · Agent Frameworks

Covers agent frameworks and orchestration runtimes: Strands, LangGraph, CrewAI, and what each commits a platform team to operating.

Keep reading