Language Switch Icon Th

AI for business

What Is an AI Gateway? How It Differs from an API Gateway and When You Need One

By FMF team Published 8 min read
Diagram of applications calling one AI gateway that applies policy and budgets, routes to approved models and records logs and cost

An AI gateway is a single control point between your applications and the AI models they use. Every request to a model provider passes through it, so the company can hold provider keys centrally, route requests to the right model, set budgets and rate limits per team, log usage and cost, and apply data rules before prompts leave the company. It differs from a classic API gateway because it understands tokens, model costs, streaming responses and the content of prompts. A company needs one when several applications or teams use several models; with one application and one provider it is usually unnecessary.

This guide is for IT managers and technical leads deciding whether to add an AI gateway and how. It covers what a gateway does, how it compares with an API gateway, a reference architecture, the security and cost questions, and the build-or-buy decision.

Why companies add an AI gateway

The need usually appears after the first few AI projects. Each team has its own provider account and key, nobody can say what AI costs per department, prompts with customer data go to providers without a common rule, and switching to a cheaper or better model means changing every application. A gateway puts these decisions in one place:

  • Keys: provider keys stay in the gateway. Applications and teams receive their own internal keys, which can be limited or revoked without touching the provider account.
  • Cost control: token budgets and rate limits per application, team or user, and a report of spend by each.
  • Routing and fallback: one internal API in front of several models, so a request can go to a cheaper model for simple work, or to a second provider when the first is down.
  • Visibility: a log of who called which model, how many tokens, how long it took and what it cost.
  • Data rules: checks on prompts and responses, such as masking personal data or blocking requests to providers that are not approved for a given data type.

AI gateway vs API gateway

An API gateway sits in front of your own APIs and controls who may call them. An AI gateway sits in front of external or internal AI models and controls how your applications use them. Many API management platforms now offer AI plugins, so the two can be the same product, but the functions differ.

API gatewayAI gateway
Sits in front ofYour services, for outside or internal callersAI model providers and self-hosted models, for your applications
Unit of limits and costRequests per second or per monthTokens, model price and requests
ResponsesUsually short and completeOften streamed token by token; can take many seconds
RoutingBy path, version or loadBy model, cost, latency, provider availability
Content inspectionHeaders and schema validationPrompt and response text: personal data, policy, injection patterns
CachingIdentical requestsIdentical prompts; some offer similarity-based caching, which needs care
Typical ownerPlatform or integration teamPlatform team with security and finance input

Reference architecture

Where an AI gateway sits

Applications call one internal endpoint. The gateway applies the company's rules before any request reaches a model.

  1. CallersApps, assistants, agentsEach with its own internal key
  2. GatewayIdentify the callerTeam, application, user
  3. PolicyBudgets, limits, data rulesMask, block or allow
  4. Route
    1. Provider A, main model
    2. Provider B or smaller model, fallback
  5. RecordLogs, tokens, costAccess-controlled, with retention rules

Most gateways expose one API format, often compatible with the OpenAI API because many SDKs and tools already support it, and translate requests to each provider. Applications then switch models by changing a model name, not their code. In practice prompts still need testing on the new model, because models differ in how they follow instructions.

Business requirements to settle first

QuestionWhy it matters
Which providers and models are approved, for which data?Defines routing rules and what the gateway must block
Who pays for usage, and at what level?Budgets per team or application need an owner and a limit
What may be logged, and for how long?Prompts can contain personal and confidential data; logs need the same protection as the source
Where must data be processed?Affects provider choice, gateway hosting and cross-border transfer duties under PDPA
What happens when a provider is down?Decide which applications get fallback and which can wait
Which applications and agents will use it?Sets capacity, streaming needs and how strict the defaults are

Security: what a gateway does and does not solve

  • It does centralise secrets. Provider keys are no longer copied into many applications and laptops.
  • It does give one place for data rules, such as masking ID card numbers or phone numbers before a prompt leaves, and blocking unapproved providers.
  • It creates a sensitive log. Full prompt and response logs are valuable for debugging and audit, and risky if anyone can read them. Restrict access, mask personal data in logs, and set a retention period.
  • It does not make prompt-injection protection complete. Pattern filters catch some attacks, not all. Applications and agents still need limited permissions and approval for risky actions.
  • It becomes critical infrastructure. If the gateway is down, every AI feature is down. Run it with redundancy and monitoring like any production service.

Our AI governance and data security checklist covers PDPA duties and vendor questions in more detail.

Costs and savings

The gateway itself costs hosting and maintenance if self-hosted, or a subscription that often scales with requests or log volume if bought as a service. Log storage grows with usage and should be included. Savings come from three places: budgets and limits stop runaway usage, routing simple tasks to smaller models lowers the average price per request, and caching avoids paying twice for identical requests. How much each saves depends entirely on your traffic, so measure for a month before and after rather than relying on vendor estimates.

Similarity-based caching returns a stored answer for a prompt that is close to an earlier one. It can save money on repetitive questions, but it can also return an answer that was right for a different user or context. Use it only where answers do not depend on the user or on changing data.

Build, buy or skip

OptionFits whenWatch for
Skip for nowOne application, one provider, low volumeStill log usage and keep keys in a secret store; revisit when a second team starts
Managed gateway serviceYou want results quickly and accept a third party in the data pathWhere it processes and stores prompts, pricing at your volume, exit path
Your cloud provider's gateway or API management add-onYour applications already run on that cloudSupport for the providers and models you use
Self-hosted open-source gatewayData must stay in your environment, or you need custom rulesYou run upgrades, scaling, monitoring and security

Implementation in five steps

  1. Inventory current AI use: which applications call which providers, with whose keys, and what data they send.
  2. Write the policy: approved models per data type, budgets, logging and retention, fallback rules.
  3. Deploy the gateway with one non-critical application first; measure added latency and check streaming.
  4. Move applications one by one, issuing internal keys and revoking direct provider keys as each moves.
  5. Review monthly: spend by team, errors, blocked requests and whether the routing rules still match the models available.

How FMF approaches it

FMF starts with the inventory and the policy, because the product choice follows from them. We check which applications and assistants call AI today, what data they send, and where the company needs control, then recommend whether a gateway is needed yet and which option fits. When AI is connected to company systems, FMF designs the same controls into the integration: limited service accounts, logged calls and human approval for actions that are hard to undo. Our guide to integrating AI with existing business systems describes that side.

FAQ

Is an AI gateway the same as an LLM proxy?

The terms overlap. "LLM proxy" usually means the basic function of forwarding requests to model providers through one endpoint. "AI gateway" usually adds policy, budgets, routing, logging and security features on top.

Does an AI gateway slow responses down?

It adds a small delay per request, usually much smaller than the model's own response time. Measure it with your traffic, and make sure the gateway supports streaming so users still see answers appear as they are generated.

Can we use our existing API gateway?

Possibly. Several API management platforms offer AI features such as token limits and model routing. Check that it supports streaming, token-based limits, the providers you use and the logging controls you need.

Does a gateway make us PDPA compliant?

No tool does that alone. A gateway helps you apply and evidence rules, such as masking personal data and restricting providers, but the legal basis, notices and transfer safeguards remain your responsibility. This article is not legal advice.

Illustrative budget

Planning scenario. These figures apply FMF's standard rate of THB 1,000 per hour to hypothetical inputs. FMF quotes each project after scoping.

For a self-hosted gateway in front of two model providers, serving three internal applications with team keys, budgets, masked logging and monitoring, assume 64 hours of delivery work (8 eight-hour days): a THB 64,000 build, plus hosting and log storage, which depend on volume.

Next step

List the applications that call AI today, the providers they use, who holds the keys and what data they send. If that list has more than one team or provider on it, a gateway is worth scoping.

Plan AI access control with FMF

FMF can review how your applications use AI today, write the access and data policy, and set up a gateway or equivalent controls with logging and budgets. Tell us which applications and providers you use and what data they handle.

Explore AI for large businesses and see the AI Wiki case with role-based access.

Discuss AI access control Chat with us on LINE

Let's discuss your next project