Skip to content

AI Gateways and LLM Routers Explained

Published Updated

An AI gateway sits between your applications and model providers, so you can decide which model handles each request and apply the same controls across apps. It earns its place when several apps need shared rules for access, routing or logging. If one app calls one model and its existing controls cover the job, a direct connection is usually enough.

What an AI Gateway Does

An AI gateway, also called a large language model (LLM) gateway or LLM proxy, gives applications one endpoint for model calls. Each application can have its own key. The gateway authenticates the application, checks its rules and forwards the call to a provider using a credential it manages.

Gateways can limit how fast each application sends requests and reject further calls when a spend cap is reached. Logs can record the chosen model, token usage and whether the call succeeded. A cache can return an earlier answer where requests are safe to reuse. A fallback can try an approved provider if the first fails. Guardrails can inspect prompts and responses, for example to redact personal information before a prompt leaves the organisation.

An ordinary application programming interface (API) gateway routes web requests and can enforce access or rate limits. Its standard controls treat model traffic like any other API request. An AI gateway can count tokens, choose a model and apply rules to prompt content. General-purpose gateways can gain those features through AI-specific policies or plugins.

Model Routing: Sending Each Task to the Right Model

A model router decides which model handles a request. A rule can send routine document labelling to a smaller model and reserve a stronger model for questions that need reasoning across several documents. The application can declare the task, or a classifier can infer it from the request. Test what the router does when the classifier is unsure.

A fallback runs when the chosen provider fails or times out. You can also allow a fallback on a rate-limit error. The gateway can try another provider serving the same model or a different approved model.

Keep region and retention restrictions in force on every route. For a streamed reply that has already reached the user, restarting on another provider can produce a different answer. Handle that as an interrupted response.

A cheaper route only saves money if the answers remain good enough for the task. Replay real examples through each proposed route before launch. Include routine requests, ambiguous ones and cases where a wrong answer has a high cost. Compare answer quality against a reference result and count retries, latency and the cost per usable answer. Then force a test timeout to see which fallback runs and what the user receives.

LLM Gateway Options Compared

Choose the operating model first. A hosted gateway saves you running the proxy, while a self-hosted gateway puts the proxy and its logs under your control. A hybrid deployment splits those jobs between your infrastructure and a vendor’s management service. If you already run an API gateway or use a single cloud for inference, compare the AI controls you can add there.

Hosted Gateways

Cloudflare AI Gateway brings analytics, caching and rate limits into Cloudflare’s network. Cloudflare lists its core features without a separate fee. Model usage and some logging can still incur charges. You can keep request metadata and turn off storage of the raw prompt and response.

Vercel AI Gateway gives applications on Vercel a managed route to different models. Vercel charges tokens served through its own provider keys against gateway credits at provider list rates. With your own keys, your model provider bills you for the tokens it serves.

The gateway deletes prompts and responses after each request and keeps request metadata. Eligible accounts can restrict requests to providers and models that offer zero data retention. Team-wide filtering adds a per-request charge.

OpenRouter provides one API key for models from multiple providers, with model and provider selection behind the same endpoint. Its Standard and Business plans charge a fee when you buy credits. The handling of prompt text depends on both the gateway settings and the upstream endpoint’s policy.

Self-Hosted and Hybrid Gateways

LiteLLM is an open-source gateway you can run in your own cloud to put multiple providers behind one API. Your team runs the proxy and chooses where logs go. It can turn off message logging while keeping usage metadata. Admin single sign-on is free for up to five users from version 1.76.0. Larger teams need an Enterprise licence.

Portkey is now Prisma AIRS AI Gateway. It applies shared prompt rules across model providers, with a hosted proxy or one you run in Kubernetes. The vendor still manages configuration in hybrid mode. The licence meters traffic by token.

Palo Alto Networks lists US and EU service availability and documents one year of retention for gateway logs containing prompts and responses. In hybrid mode, you can export payloads to Amazon S3 storage you control.

Kong AI Gateway extends Kong policies to AI calls, useful if your network team already manages API traffic in Kong. Kong documents a hybrid setup with proxy nodes you run and a Konnect management service. Logging settings can send the full request and response to configured destinations. Price the Konnect resources and the infrastructure for your proxy nodes separately.

Controls in Your Existing Cloud

Azure API Management adds token limits and load balancing across AI endpoints to an existing API gateway. This can fit a team that already manages access and routing there. Select the gateway tier and decide which request details your diagnostic settings will retain.

Amazon Bedrock intelligent prompt routing can choose between supported models in the same model family. It fits teams that already use Bedrock and want to route requests within that set. Invocations can be logged to CloudWatch Logs or Amazon S3 if you enable logging.

When You Need a Gateway and When You Do Not

One application calling one model rarely needs an AI gateway if it can manage its own credentials, access and error handling. Add a gateway when teams are duplicating those controls or when changing models requires a release in several applications.

Every proxy adds a network hop and needs someone to monitor it. A hosted gateway also receives prompts on their way to the model. Its logs and caches can create extra copies of that content. Measure the added delay on real requests and compare the data path against your organisation’s rules before making the gateway a dependency.

Running a Gateway in Your Own Cloud

Run the gateway in your organisation’s cloud account and approved region if your team needs direct control of where it processes prompts and writes logs. Put the proxy behind a private endpoint where the applications can reach it. Keep its logs and backups in approved storage. Trace each route through to the model provider, including fallbacks, because the gateway’s region does not determine where the model runs.

Connect the administration interface to your identity provider through single sign-on (SSO). Give applications separate credentials that can be rotated without affecting other apps. Set deletion periods on the log store and any exports. Keep request metadata for troubleshooting and restrict access to prompt text if a specific investigation requires it. For AI observability, record request IDs and model names so you can trace the route without retaining the conversation.

Name the platform owner who can approve new providers and change routing rules after launch. Before launch, run one application through the gateway and confirm its normal calls work. Try an unapproved route and confirm the gateway blocks it. Trigger the approved fallback and check that it follows the same rules.