BlogInfrastructure

What an LLM gateway does, and when a company needs one

An LLM gateway is one service between your applications and the model providers: requests pass through it, so keys, budgets, model access, routing, fallbacks and logs are handled in one place instead of in every application. A company needs one once several teams or tools call models from more than one provider, or when someone has to answer who spent what and which team may use which model. With one application on one provider, the provider's own keys and console are usually enough for now.

By Updated

The problems an LLM gateway solves

A gateway solves coordination problems. They appear when model use spreads across teams, and no single application can fix them on its own. These are the five we hear most often, in the words people use:

  • 'Every team has its own provider keys and nobody knows how many exist.' The gateway holds the provider keys and gives each team, service or developer its own gateway key, which can be limited and revoked on its own. In LiteLLM, for example, each virtual key carries its permitted models, its budget and the team that owns it.
  • 'We get one invoice and cannot say which team caused it.' Each request is logged with its key, team, model and token count, so spend can be summed per team and per use case.
  • 'Switching to another model means code changes in every application.' Applications call one endpoint with a model name, and the gateway maps that name to a provider deployment. Switching becomes a configuration change, although prompts and outputs still have to be tested against the new model.
  • 'When the provider has an outage, our features go down with it.' The gateway retries and falls back to another deployment or provider by rules you set in advance.
  • 'Which data may go to which model?' A gateway can enforce the answer, but it cannot reach it. It controls which keys and teams may call which models and records what was sent. It does not know by itself whether a prompt contains customer data. Some gateways offer PII detection or redaction as an optional guardrail, yet the classification rules come from your data protection owners, and each application still decides what it puts into a prompt.

If none of these hurts yet, a gateway is one more service to patch, monitor and keep available, and it can wait. That is our judgement. It is also the most common good reason to put one off.

What a gateway does and what stays outside it

A gateway governs the traffic to models. It does not run them, decide what data an application may read, or tell you whether the answers are any good. The table shows the usual split.

Typical responsibilities of an LLM gateway and what other parts of the platform own. Exact features differ by product and licence
AreaHandled by the gatewayStill needed outside it
Keys and budgetsIssues keys per team, service or developer and enforces model access, rate limits and spending limitsAn identity provider for users and a secrets manager for the provider credentials
Routing and fallbacksMaps a model name to deployments, balances load, retries and fails over on errorsAn evaluation showing the fallback model is acceptable for each task
LoggingRecords key, team, model, tokens, cost and latency per request, and prompts and responses if you switch that onA retention decision and a place to analyse the logs, such as your monitoring stack
CachingReturns stored responses for identical requests, or for similar ones with semantic cachingA decision on which routes may be cached at all
GuardrailsRuns checks on prompts and responses, such as blocked topics or PII redaction, where the product offers themThe policy those checks implement, and tests that show they work
Model servingForwards requests to an endpointCloud model deployments in your own account, or self-hosted serving such as vLLM on Kubernetes
Data accessNothing: it sees only what the application sendsPermissions in your retrieval system and in the tools agents call
EvaluationSupplies logs that can feed test setsTest sets, acceptance tests and regression runs before each model or prompt change

The split matters when you plan the work. In our experience, a project scoped as 'install a gateway' leaves the fallback evaluation, the log retention decision and the guardrail policy without an owner, and those are the parts auditors and incident reviews ask about.

The main LLM gateway options as of 7 November 2026

Most companies choose between a self-hosted open-source gateway, the AI features of an API management product they already run, and a hosted gateway. The table covers seven common options and lists only facts we checked on the vendors' own pages on 7 November 2026. Ownership, names and features in this market changed several times this year, so check again before you decide.

LLM gateway options as described on the vendors' own pages, checked on 7 November 2026. Features marked beta or preview by the vendor are named as such. No prices are shown
OptionHow it runsLicence and ownershipWorth knowing
LiteLLMSelf-hosted proxy, usually as containers in your own cloud account or data centreOpen source under the MIT licence; an enterprise licence adds SSO for more than five users, audit logs, tag-based budgets, per-key guardrails and secret manager integrationsVirtual keys with budgets and model lists, spend per key and team, fallbacks and caching are in the open-source version. 2026 saw three incidents: malicious PyPI releases 1.82.7 and 1.82.8 on 24 March, the actively exploited CVE-2026-42271 (fixed in 1.83.7) and, on 21 October, a malicious 1.107.0 from LiteLLM's own release pipeline, published to PyPI and as Docker images
Kong AI GatewayAI plugins on Kong Gateway: self-managed, with data planes in your environment connected to Kong's Konnect control plane, or as dedicated cloud gateways hosted by KongKong's documentation lists Kong Gateway Enterprise as a requirement for the on-premises setup of its AI Proxy Advanced pluginProviders include OpenAI, Anthropic, Azure, Amazon Bedrock and Gemini; token rate limiting, semantic caching, prompt guards and PII sanitisation come as plugins. Also covers MCP and agent-to-agent traffic
Azure API ManagementAI gateway policies inside an API Management instance in your Azure subscriptionPart of API Management, with availability by service tier. Microsoft also offers a separate AI Gateway product, in public preview in East US 2 and Sweden Central according to a page updated on 28 October 2026Token limits, token metrics, semantic caching, backend load balancing with a circuit breaker and content safety checks. Backends include Microsoft Foundry, Amazon Bedrock and self-hosted endpoints
Cloudflare AI GatewayHosted service on CloudflareAvailable on all Cloudflare plansAnalytics, logging, caching, rate limiting, retries and model fallback; spend limits, guardrails, data loss prevention, dynamic routes and storing your provider keys are marked beta
PortkeyHosted gateway; the open-source gateway can also be self-hostedOpen-source gateway under the MIT licence. Palo Alto Networks closed its acquisition of Portkey on 29 May 2026, and the documentation now names the product Prisma AIRS AI GatewayConditional routing, fallbacks, simple and semantic caching, cost and token budgets, rate limits. Ask about the roadmap for your use case after the change of owner
OpenRouterHosted router with its own model catalogue and billingStripe announced an agreement to acquire OpenRouter on 19 August 2026; OpenRouter said its name, product and roadmap stay the sameMore than 400 models from more than 80 providers, according to Stripe. EU in-region routing through a separate EU base URL on the Business plan; account and billing records may still be processed in the US
Agent Router (formerly Envoy AI Gateway)Self-hosted, built on Envoy Proxy and Envoy GatewayApache 2.0. Renamed and moved to the Agentic AI Foundation in September 2026OpenAI-compatible API for models, an MCP gateway for tools, token usage limits and failover. Existing Envoy AI Gateway deployments do not need to migrate because of the rename

Many of the 'best LLM gateway' and 'LiteLLM alternatives' lists you will find are published by vendors of a competing gateway. They are useful for collecting names and less useful for choosing. Two of the seven options above were acquired or agreed to be acquired in 2026 and a third was renamed. That is a practical reason to keep your applications on a standard API format, so the gateway itself can be replaced.

How to choose an LLM gateway

Choose by where the gateway must run and who will operate it. Then check provider coverage, licence and data rules. The feature lists are so similar that they rarely decide anything on their own.

  • Self-hosted or hosted. A self-hosted gateway runs in your network or cloud account, so prompts and logs stay where you deploy it, but you patch, scale and monitor it. A hosted gateway takes that work away and adds another party that processes your prompts, whose terms your data protection owners have to accept.
  • Existing API management. If you already run Azure API Management or Kong, check their AI features first. They may cover keys, limits and logging without adding a new component that someone has to learn.
  • Provider and client coverage. List the providers and API formats you need now and next year, including models deployed in your own Azure or AWS account and any self-hosted models. Coding agents add a constraint: Claude Code works with any gateway that exposes a supported API format, and Anthropic notes that the gateway has to be kept up to date as Claude Code adds capabilities.
  • Licence. Separate the features you need from those in the free or open-source edition. With LiteLLM, SSO for more than five users, audit logs and tag-based budgets need the enterprise licence, so decide early whether to buy it or to build those parts around the gateway.
  • EU data rules. Write down, for each option, where prompts, responses and logs are processed and stored. For hosted routers the answer can differ by type of data: OpenRouter processes EU-routed prompts in Europe but states that account, billing and other operational records may be processed in the US. For cloud models, the region and deployment type at the model provider matter as much as the gateway.
  • Operations effort. Count the parts besides the gateway itself. LiteLLM's documentation recommends Redis for any deployment with more than one worker or replica: without it, rate limits are counted per worker, so a limit of 100 requests per minute across four workers lets 400 through, and a revoked key stays usable on workers that did not process the revocation. Add a database for keys and spend logs, upgrades, and on-call cover for a component every AI feature depends on.

What we often see, though it is no rule: teams that have standardised on Azure API Management or Kong start there. Teams that need cloud models in their own AWS or Azure account as well as self-hosted models, and have people to run it, tend to end up with a self-hosted LiteLLM. Teams without operating capacity and with fewer data restrictions use a hosted gateway.

Where the gateway sits in your AI platform

The gateway sits in the middle of the platform: everything that calls a model goes through it, and it is the only component that holds the provider credentials. This is the path from the caller to the model:

  1. 1

    Callers

    Applications, agents and coding agents such as Claude Code. Each authenticates with its own gateway key or through your identity provider, never with a provider key.

  2. 2

    Gateway

    Checks the key, the model permission and the budget, applies guardrails, picks a deployment and writes a log entry. It runs in your network, or with the hosting provider if you chose a hosted gateway.

  3. 3

    Models

    Cloud models deployed in your own Azure or AWS account, direct provider APIs where they are approved, and self-hosted models served with vLLM on Kubernetes. Only the gateway can reach them.

  4. 4

    Logs and monitoring

    Gateway logs and metrics flow into the monitoring you already run, where cost per team, error rates and latency per provider are reported and alerted on.

This only works if traffic cannot go around the gateway. Keep provider keys in a secrets manager that only the gateway can read, restrict outbound network access to model endpoints, and compare each provider's usage report with the gateway logs to find direct calls. Coding agents can be pinned as well: as of 7 November 2026, setting allowedProviders to customEndpoint in Claude Code's managed settings makes it refuse sessions pointed anywhere other than your gateway, from Claude Code v2.1.285.

Rolling out a gateway step by step

Roll out a gateway one team and one model route at a time, with budgets, logging and fallbacks tested before the first production request goes through it.

  1. 1

    Take stock of current use

    List every provider account, key and team that calls models today, and what each spends according to the invoices.

  2. 2

    Agree the rules

    Decide which teams may use which models, the budgets, which routes may be cached, and whether prompts are logged and for how long. Your data protection owners sign off the last point.

  3. 3

    Deploy and harden

    Run the gateway in your environment or set up the hosted service, with provider keys in a secrets manager, no public admin interface, pinned versions and alerts on errors and latency.

  4. 4

    Test before real traffic

    Check that budgets stop requests, that revoked keys stop working on every replica, that fallbacks trigger on the right errors and that the logs contain what you agreed. Run your evaluation set through the fallback routes too.

  5. 5

    Move one team first

    Switch one application or team to the gateway endpoint, compare gateway spend with the provider's own report for the same period, and explain any gap before moving the next team.

  6. 6

    Close the bypass

    Once every team is on the gateway, revoke the old provider keys held by applications and block direct network access to the providers.

  7. 7

    Operate it like production

    Patch on a schedule, review spend per team every month and repeat the fallback and key revocation tests after each upgrade.

Cloudsail sets up LiteLLM and the platform around it, including the tests above, in a client's own AWS or Azure account or on the client's own servers, and our engineers in Germany and Poland can run it afterwards if you do not want to.

Questions

Is an LLM gateway the same as an AI gateway or an LLM proxy?

Mostly, yes. 'LLM proxy' and 'LLM gateway' are the developer terms for a service that forwards model requests. 'AI gateway' is the broader product term and often also covers MCP tool traffic and calls between agents. Kong's AI Gateway, Azure API Management and Agent Router, for example, all handle MCP traffic in the same product.

Do we need a gateway if we only use one provider?

Not necessarily. Separate workspaces, projects or keys per team at the provider already give you separate credentials and a basic spend breakdown. A gateway starts to pay off when you add a second provider or self-hosted models, need budgets enforced across teams, want one audit log for all model calls, or need fallbacks when that one provider fails.

Does a gateway slow requests down?

It adds a network hop and some processing per request. How much depends on the product, where you deploy it relative to your applications and providers, and features such as guardrails that inspect every prompt. Measure the 95th percentile latency with and without the gateway on your own traffic before rollout instead of relying on vendor benchmarks.

Can a gateway decide which data may go to which model?

No. It enforces decisions made elsewhere: which keys and teams may call which models, and what gets logged. Optional guardrails such as PII redaction catch some personal data, but they only detect patterns and know nothing about your data classification. To keep a sensitive use case on an approved model, give that application a key that can reach only that model.

Is LiteLLM still a sensible choice after its 2026 security incidents?

It can be, with the right operating model. 2026 saw three incidents: malicious PyPI releases 1.82.7 and 1.82.8 on 24 March, the actively exploited CVE-2026-42271 (fixed in 1.83.7) and, on 21 October, a malicious 1.107.0 from LiteLLM's own release pipeline, published to PyPI and as Docker images. Anyone who ran an affected version should rotate the credentials on those systems. What matters for the decision is how you run it: versions pinned by digest and verified, no public admin endpoints, credentials in a secrets manager and a patch process with an owner.

Talk to an engineer

Bring one piece of work you would like to improve. The call takes 30 minutes and needs no access to your systems or your data.

Booking runs on Google Calendar.

Prefer to write first? Leave your email and a few lines, and we reply with times.

The button prepares an email in your own email program, for you to send. Privacy policy (draft)