AI Gateway
An AI gateway is a governance layer for large language model invocations, responsible for cross-cutting concerns such as model routing, centralized API key management, and cost and quota control. It abstracts away API differences across LLM providers. Representative implementations include LiteLLM, Portkey, and Kong AI Gateway.
Core Facts
An AI gateway centrally handles responsibilities such as unified entry point and routing, access control and identity governance, compliance and audit trail, and cost and usage observability.
Modern AI applications adopt a "front-end and back-end separation" architecture, where the front end handles user interaction and engineering capabilities, the back-end foundation handles language understanding and code generation, and the two communicate via a standardized API protocol.
Timeline (last 90 days)
Compared with traditional Web API gateways, AI traffic requests carry longer prompt contexts, responses may stream continuously for several seconds or even longer, and the per-call cost is far higher than that of ordinary APIs.
Using an AI gateway adds one network hop, but relative to generation times of hundreds to thousands of milliseconds, this overhead is small under most workloads.
Many AI gateway and proxy services use a pricing model that takes a percentage of usage cost, typically between 5% and 20%.
Before building a router, instrumentation should be done first, collecting structured metadata such as the request's prompt length, context size, whether a tool call is requested, whether the output is constrained by a schema, and whether a human accepts the result; usually two weeks of data is enough to judge whether routing is worth doing.
The gateway should simultaneously take on cost-independent security control functions, such as egress inspection, PII redaction, prompt injection screening, and enforcing per-team budgets, and the routing layer and the security layer should not be built separately.
The gateway should serve as the sole entry point for all model calls, and the application layer should not communicate directly with any model provider, in order to support functions such as authentication, classification, routing, output validation, upgrades, and metering.
If the gateway implementation relies on unbounded in-memory queues to buffer chunks from upstream, under high-concurrency scenarios of 5,000 to 10,000 active streams, memory usage will grow linearly with connection duration, directly causing OOM crashes.
In enterprise environments, streaming traffic typically passes through three layers: the client interface, the intermediate AI gateway, and the upstream model provider.
By assigning fine-grained virtual keys to specific services at the gateway layer, teams can configure automatic rate limits and token budgets, enforcing budget thresholds before runaway costs accumulate.
Running tests in CI through a locally orchestrated gateway can ensure that all requests benefit from semantic caching, greatly accelerating repeated test suite execution while preventing identical evaluation runs from consuming unnecessary API quota.
16 more timeline events
All Facts (20)
An AI gateway centrally handles responsibilities such as unified entry point and routing, access control and identity governance, compliance and audit trail, and cost and usage observability.
75%VerifiedModern AI applications adopt a "front-end and back-end separation" architecture, where the front end handles user interaction and engineering capabilities, the back-end foundation handles language understanding and code generation, and the two communicate via a standardized API protocol.
65%Unverified随着大模型生态的碎片化加剧,统一的AI接入层和管理层变得不可或缺
70%UnverifiedCompared with traditional Web API gateways, AI traffic requests carry longer prompt contexts, responses may stream continuously for several seconds or even longer, and the per-call cost is far higher than that of ordinary APIs.
50%UnverifiedUsing an AI gateway adds one network hop, but relative to generation times of hundreds to thousands of milliseconds, this overhead is small under most workloads.
50%UnverifiedMany AI gateway and proxy services use a pricing model that takes a percentage of usage cost, typically between 5% and 20%.
50%UnverifiedThe gateway should simultaneously take on cost-independent security control functions, such as egress inspection, PII redaction, prompt injection screening, and enforcing per-team budgets, and the routing layer and the security layer should not be built separately.
50%UnverifiedBefore building a router, instrumentation should be done first, collecting structured metadata such as the request's prompt length, context size, whether a tool call is requested, whether the output is constrained by a schema, and whether a human accepts the result; usually two weeks of data is enough to judge whether routing is worth doing.
50%UnverifiedThe gateway should serve as the sole entry point for all model calls, and the application layer should not communicate directly with any model provider, in order to support functions such as authentication, classification, routing, output validation, upgrades, and metering.
50%UnverifiedIn enterprise environments, streaming traffic typically passes through three layers: the client interface, the intermediate AI gateway, and the upstream model provider.
50%UnverifiedRunning tests in CI through a locally orchestrated gateway can ensure that all requests benefit from semantic caching, greatly accelerating repeated test suite execution while preventing identical evaluation runs from consuming unnecessary API quota.
50%UnverifiedBy assigning fine-grained virtual keys to specific services at the gateway layer, teams can configure automatic rate limits and token budgets, enforcing budget thresholds before runaway costs accumulate.
50%UnverifiedLLM routing is one of the core capabilities of AI gateways, referring to the gateway automatically selecting the most suitable backend model based on request characteristics.
50%UnverifiedAI gateways need to complete usage statistics, content filtering and interruption handling during the streaming process, which is more complex than the traditional request-response model because the gateway needs to make real-time decisions amid the data flow.
50%UnverifiedThe positioning of AI gateways is expanding from mere traffic forwarding and API key management to taking on model selection and decision-making.
50%UnverifiedAI网关通常充当反向代理或SDK包装器,其数据流大致为:网关接收入站HTTP请求并创建根span,随后为具体操作创建子span(如`retrieval.search`、`llm.inference`、`llm.generate`),span通过OTLP批量导出到collector,再路由到Jaeger或Tempo进行存储与可视化。
50%UnverifiedAI gateways will soon become the single component within an organization that can see every prompt, every completion, and every tool call.
50%UnverifiedWhen evaluating a gateway's detection capability, one should prepare three categories of probes—benign, direct injection, and indirect injection—route all of them through the gateway rather than directly to the provider, and measure both attack pass-through rate and legitimate-request false-block rate.
50%UnverifiedEvery gateway interaction should produce a structured record containing trace_id, user_id, timestamp, model name, input/output token counts, latency, policy violations, and a list of tool calls, with the trace ID used to correlate multiple fanned-out calls.
50%UnverifiedThe EU AI Act's high-risk category requires systems to automatically log events sufficient to reconstruct the decision process, making gateway log tamper-resistance and data-residency options a legal compliance requirement.
50%