Table of contents

Thousands of companies trust Merge to accelerate AI from PoC to production.
Get a demo

AI gateway: overview, features, and top solutions

Jon Gitlin
Senior Content Marketing Manager
at Merge

Running LLMs in production means routing each request to the best-fit model to cut costs, prevent outages, and get higher-quality responses.

That’s where an AI gateway solution can help.

We’ll help you leverage this type of solution by breaking down how they work and common 3rd-party vendors. But to start, let’s align on what an AI gateway is.

What is an AI gateway?

An AI gateway, also known as an LLM gateway, is a control layer between your apps and AI models that routes requests and centralizes governance so teams can run AI reliably in production. 

It exposes a single API endpoint to manage, add, or swap providers and models without changing downstream integrations.

AI gateway visualization

How AI gateways work

While every implementation differs, they typically include the following components:

  • Model access: you’ll be able to access hundreds of open and closed models from providers like OpenAI, Anthropic, Google, Qwen, and Bytedance
  • Routing logic: choose from a range of routing strategies, from an ordered fallback list to defining "best" by the benchmarks you weight, then letting the gateway score each model and route to the highest scorer
How Merge Gateway's Bring Your Own Router works
Merge Gateway lets you define a weighted blend of benchmarks to score every model and pick a winner
  • Cost governance: assign monthly budgets for a certain user or group of users (e.g., a customer) and get alerted when they’re approaching that budget
  • Observability: Leverage logs of every API request that passes through your AI Gateway, with details like the model used, end-to-end latency, and the number of input and output tokens consumed

Putting these components together, here’s how an AI gateway can work: 

Once a request gets submitted, your app sends it to the gateway. The gateway scores the available models against your weighted benchmarks, routes to the best one (and fails over if it's down), checks if the customer is within budget, and returns the response through the same endpoint while fully logging it. 

Related: How LLM routing works

Popular AI gateways

To help you avoid building and maintaining an AI gateway in-house, you can use one of the many popular solutions on the market. 

Here’s a snapshot of your best options, along with the pros and cons of each:

Portkey

Portkey is an AI gateway and observability layer that sits between your app and multiple LLM providers to standardize requests, add routing/fallback, and give you logs, analytics, and governance controls.

Pros

  • Comprehensive and centralized observability (tracing, logs, cost/token analytics, etc.) across providers
Snapshot of Portkey's logs
Portkey’s logs include key details from a request
  • Supports a broad range of LLMs (currently supporting more than 3,000 models)

Cons

  • Routing rules, policies, and virtual keys become their own surface to manage and keep in sync across environments, on top of your existing application config
  • The observability layer captures and stores prompt and response content along with metadata, which matters for sensitive workloads. Portkey offers PII redaction, retention controls, and self-hosting to address this, but configuring them correctly is on you
  • The Palo Alto Networks acquisition adds uncertainty to Portkey’s product roadmap, and could slow down their velocity, which can be detrimental for such a fast-changing product space

Related: The top alternatives to Portkey

OpenRouter

OpenRouter offers a simple way to route requests to different models and manage usage via a single integration.

Pros

  • Flexible free account to help you validate the API and the platform more broadly
OpenRouter's pricing plans
While not super comprehensive, OpenRouter’s free plan lets you route requests to 25+ models and make 50 requests every day
  • Large Discord community to help you chat with other users and get tips for using the platform
  • Offers a simple onboarding process. For example, you can get your OpenRouter API key in seconds

Cons

  • Routing is optimized for provider/model selection only, with no ability to route by customer, feature, region, or use case
  • You’ll only get basic privacy controls and provider safeguards, with no enterprise DLP or prompt-injection protection
  • Cost tracking doesn't map to SaaS economics. Spend tracking is limited to org, workspace, and project level, so you can't attribute cost by customer, team, or feature

Related: A guide to OpenRouter alternatives

Merge Gateway

Merge Gateway is a production control plane for LLM traffic that provides a single API to multiple models, plus routing, cost controls, security/policy guardrails, and audit-ready observability.

Pros

  • Enforce per-customer and per-project model and region policies, filter sensitive data with built-in DLP and prompt-injection protection, and log every routing decision, cost, and outcome
  • Cap spend in real time by project, team, or customer tier, attribute every dollar to a model, provider, and team, and consolidate provider invoices into one. Instant automatic failover routes around provider outages with no code changes
How to set spend limits in Merge Gateway
Merge Gateway lets you set spending limits and consumption-based alerts
  • Offers “Build Your Own Router,”  which lets you define what "best" means using weighted benchmarks or your own eval scores. The gateway scores each model and picks a winner per request, and shows which model won, why, and which rules fired

Start routing LLM requests to Merge Gateway by signing up for a free account.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

How to connect a Box MCP with Claude Code (4 steps)

Insights

AI audit logs: overview, benefits, and best practices

AI

How we use Agent Handler for Employees to give Mergies secure AI access

Company

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text