AI Gateways & LLM Proxy Infrastructure

AI Gateways & LLM Proxy Infrastructure

An AI gateway (LLM gateway / LLM proxy) is the production traffic-and-control plane between your applications and one-or-many LLM providers. It exposes a single, usually OpenAI-compatible API while centrally enforcing key management, rate limits, budgets, fallbacks, caching, guardrails, observability, and governance. The category exists because traditional API gateways cannot count tokens, cannot treat streaming (SSE) responses as first-class, cannot enforce content-level security, and have no notion of multi-provider model credentials or token-cost attribution. This skill is the ops/governance proxy plane — not the algorithm that decides which model answers a request.

When to use / Skip

Use this skill when you are:

Skip to a peer when the task is:

The AI-gateway control plane

A gateway is measured against this feature taxonomy. Each row is a column to fill when you compare vendors.

# Capability What it means at the proxy
1 Unified OpenAI-compatible API One /chat/completions surface; switch provider by changing the model string. Chat Completions is universal; Responses API support is emerging/uneven; some add Anthropic /v1/messages + MCP passthrough.
2 Virtual keys + key vault Scoped proxy keys per team/app; provider keys stored in a vault (BYOK), rotated/revoked centrally.
3 Rate limiting & quotas RPM / TPM / parallel-request caps per key/user/team/model; fixed vs sliding window; over-limit -> 429.
4 Budget / spend controls Dollar caps per key/team/user with reset durations; request fails when budget crossed. Distinct from rate limits.
5 Cost attribution / chargeback Per-key/team/user spend tables; breakdowns by model/provider/user-ID/tag/credential for showback/chargeback. A distinct row from budgets.
6 Fallback / retry / load balancing Reliability: retry -> cooldown -> fall back to another deployment/provider on 429/5xx/timeout; LB strategies (shuffle, least-busy, latency, cost).
7 Caching Exact-match (cache-key + TTL) is universal; semantic caching is an optional feature. See the caching note below.
8 Guardrail / PII enforcement Input/output validation, PII/PHI redaction, content filtering, allow/deny lists, before/after-request hooks.
9 Observability / logging / tracing Request/cost/latency logs; Prometheus, OpenTelemetry, Langfuse, dashboards.
10 Governance / RBAC / audit Role-based access, org-level policy, audit logs, SSO/SAML.
11 Streaming pass-through SSE relayed without buffering, preserving TTFT. (Bedrock pattern uses Lambda Web Adapter to do SSE without a VPC.)
12 Deployment model Self-hosted OSS / managed SaaS / edge / platform-native — see Selection.

Caching at the gateway (and the boundary)

Gateways implement exact-match caching with an explicit cache key + TTL:

Some gateways add semantic caching (embedding-similarity hits on differently-worded but same-meaning prompts): Portkey (simple + semantic), Kong AI Semantic Cache (3.8; embeddings generated on the fly, stored in Redis or Postgres). At the gateway you decide where the cache sits, the key, TTL, and how it interacts with cost attribution. For the similarity/threshold internals and the algorithmic risk of false hits (GPTCache et al.) -> llm-routing-cascades.

Vendor landscape

Prices/limits churn fast — every figure below is as documented in 2025-2026; re-verify against the primary source before quoting to a customer.

LiteLLM Proxy (LLM Gateway) — OSS, self-hosted-first

Portkey — OSS gateway + managed/enterprise

Cloudflare AI Gateway — managed, edge, free core

Kong AI Gateway — plugins on Kong Gateway

Helicone — OSS (Rust), observability-first that also proxies

TrueFoundry — enterprise gateway, low-latency

OpenRouter — marketplace/aggregator used as a gateway

Vercel AI Gateway — managed, GA

AWS Bedrock gateway — a pattern, not a product

Databricks AI Gateway — evolving rebrand (CONTESTED naming/GA)

Selection / decision guidance

Integration patterns

The OpenAI-compatible drop-in (the universal move — point the SDK at the gateway):

from openai import OpenAI
client = OpenAI(
    base_url="https://your-gateway/v1",   # LiteLLM, Helicone, OpenRouter, Cloudflare...
    api_key="sk-virtual-key-issued-by-gateway",  # virtual key, NOT the raw provider key
)
client.chat.completions.create(model="claude-sonnet-4", messages=[...])  # switch provider via model string

LiteLLM proxy config (virtual-key budget + fallback + cooldown):

model_list:
  - model_name: gpt-4o
    litellm_params: { model: azure/gpt-4o, api_base: os.environ/AZURE_BASE, api_key: os.environ/AZURE_KEY }
  - model_name: claude
    litellm_params: { model: anthropic/claude-sonnet-4, api_key: os.environ/ANTHROPIC_KEY }
litellm_settings:
  num_retries: 3
  cooldown_time: 30          # cooldown a model after repeated fails/min
  fallbacks: [{ "gpt-4o": ["claude"] }]   # reliability fallback (NOT model-optimization)
general_settings:
  key_management_system: "aws_secret_manager"   # store virtual keys in a vault (enterprise)
# per-key budget at creation: POST /key/generate { "max_budget": 100, "budget_duration": "30d", "rpm_limit": 60 }

Cloudflare cache + rate-limit headers (per-request override):

cf-aig-cache-ttl: 3600        # seconds (min 60, max ~1 month)
cf-aig-cache-key: <stable-hash-of-prompt>
# rate limiting + budget nodes are configured in Dynamic Routing (visual/JSON), versioned

Portkey config (fallback strategy + input guardrail):

{ "strategy": { "mode": "fallback", "on_status_codes": [429, 500] },
  "targets": [ { "virtual_key": "openai-vk" }, { "virtual_key": "anthropic-vk" } ],
  "input_guardrails": ["pii-redact"] }

Anti-patterns & failure modes

2025-2026 frontier

Sources

  1. LiteLLM — AI Gateway (LLM Proxy) overview: https://docs.litellm.ai/docs/simple_proxy
  2. LiteLLM — Virtual Keys / Budgets / Rate Limits / Fallbacks / Load Balancing / Secret Managers: https://docs.litellm.ai/docs/proxy/virtual_keys , /docs/proxy/users , /docs/proxy/reliability , /docs/proxy/load_balancing , /docs/secret
  3. Portkey — AI Gateway product + Configs + feature comparison + OSS gateway (npm): https://docs.portkey.ai/docs/product/ai-gateway , https://www.npmjs.com/package/@portkey-ai/gateway
  4. Cloudflare AI Gateway — Overview / Features / Caching / Rate limiting / Dynamic routing: https://developers.cloudflare.com/ai-gateway/
  5. Cloudflare AI Gateway — Pricing & Limits: https://developers.cloudflare.com/ai-gateway/reference/pricing/ , /reference/limits/
  6. Kong AI Gateway — docs + 3.8 + 3.10: https://developer.konghq.com/ai-gateway/ , https://konghq.com/blog/product-releases/ai-gateway-3-8 , https://konghq.com/blog/product-releases/ai-gateway-3-10
  7. Kong — API Gateway vs AI Gateway: https://konghq.com/blog/learning-center/api-gateway-vs--ai-gateway
  8. Helicone — AI Gateway overview + caching + self-hosting + GitHub: https://docs.helicone.ai/gateway/overview , https://docs.helicone.ai/features/advanced-usage/caching , https://github.com/helicone/ai-gateway
  9. TrueFoundry — AI Gateway product + on-prem guide: https://www.truefoundry.com/ai-gateway , https://www.truefoundry.com/blog/ai-gateway-on-premise
  10. OpenRouter — pricing + provider routing + FAQ: https://openrouter.ai/pricing , https://openrouter.ai/docs/guides/routing/provider-selection , https://openrouter.ai/docs/faq
  11. Vercel AI Gateway — docs + pricing + BYOK + GA changelog: https://vercel.com/docs/ai-gateway , /docs/ai-gateway/pricing , https://vercel.com/changelog/ai-gateway-is-now-generally-available
  12. AWS Bedrock Access Gateway: https://github.com/aws-samples/bedrock-access-gateway
  13. Databricks Unity AI Gateway (Beta May 2026; lineage Mosaic/MLflow): https://docs.databricks.com/aws/en/ai-gateway/ , https://www.databricks.com/product/artificial-intelligence/ai-gateway
  14. Category definition / why AI gateways emerged: https://atlan.com/know/what-is-ai-gateway-llm-gateway/

Boundary note: routing algorithms and semantic-cache internals defer to llm-routing-cascades; single-model serving to llm-inference-serving. Pricing and the Databricks gateway naming/GA are flagged as fast-moving / contested — re-verify before quoting.