AZURE HEROES
  • Home-Updates
  • Blog
    • Azure Blog
    • Azure Heroes Events >
      • Azure Heroes Sessions #1
      • Azure Heroes Sessions #2
      • Azure Heroes Sessions #3
      • Azure Heroes Sessions #4
      • Azure Heroes Sessions #5
      • Azure Heroes Sessions #6
      • Azure Heroes Sessions #7
  • Who We Are!
  • eBooks
  • Azure All In One!
    • Azure Disk & Storage
    • Azure Network
    • Azure VPN
    • Azure VMs
  • Free Azure Support!
  • Contact Us
  • Events
    • Beginners Event
    • Developers Event
    • Special Event
    • Azure Workshop #4
    • Azure Workshop #5
    • Azure Workshop #6
    • Azure Workshop #7
    • Azure Workshop #8
    • Azure Heroes Sessions #9
    • Azure Heroes Sessions #10
    • Azure Heroes Sessions #11
    • Azure Heroes Sessions #12
    • Azure Heroes Sessions #13
    • Azure Heroes Sessions #14
    • Azure Heroes Sessions #15
    • Azure Heroes Sessions #16
    • Azure Heroes Sessions #17
    • Azure Heroes Sessions #18
    • Azure Heroes Sessions #19
    • Azure Heroes Sessions #20
    • Azure Heroes Sessions #21
    • Azure Heroes Sessions #22
    • Azure Heroes Sessions #23
    • Azure Heroes Sessions #23
  • Registration Form
  • Privacy Policy
  • Home-Updates
  • Blog
    • Azure Blog
    • Azure Heroes Events >
      • Azure Heroes Sessions #1
      • Azure Heroes Sessions #2
      • Azure Heroes Sessions #3
      • Azure Heroes Sessions #4
      • Azure Heroes Sessions #5
      • Azure Heroes Sessions #6
      • Azure Heroes Sessions #7
  • Who We Are!
  • eBooks
  • Azure All In One!
    • Azure Disk & Storage
    • Azure Network
    • Azure VPN
    • Azure VMs
  • Free Azure Support!
  • Contact Us
  • Events
    • Beginners Event
    • Developers Event
    • Special Event
    • Azure Workshop #4
    • Azure Workshop #5
    • Azure Workshop #6
    • Azure Workshop #7
    • Azure Workshop #8
    • Azure Heroes Sessions #9
    • Azure Heroes Sessions #10
    • Azure Heroes Sessions #11
    • Azure Heroes Sessions #12
    • Azure Heroes Sessions #13
    • Azure Heroes Sessions #14
    • Azure Heroes Sessions #15
    • Azure Heroes Sessions #16
    • Azure Heroes Sessions #17
    • Azure Heroes Sessions #18
    • Azure Heroes Sessions #19
    • Azure Heroes Sessions #20
    • Azure Heroes Sessions #21
    • Azure Heroes Sessions #22
    • Azure Heroes Sessions #23
    • Azure Heroes Sessions #23
  • Registration Form
  • Privacy Policy

Your LLMs Need a Front Door: Why Every Enterprise AI Platform Needs an AI Gateway

9/27/2026

0 Comments

 
Every enterprise AI platform hits the same wall.​ One team gets one Azure OpenAI deployment. Six months later there are eleven apps, four agent frameworks, three model providers, keys scattered across repos and a token bill nobody can explain. The AI Gateway is the pattern that fixes it: one governed front door for every model, tool and agent call. Here's why you need one, what should (and shouldn't) go through it, and how APIM, LiteLLM and OmniRoute compare.
Picture

What an AI Gateway Actually Is

An AI Gateway is a governed front door for all LLM traffic. Applications and agents stop calling model endpoints directly and call the gateway instead. The gateway then:

Apps & Agents
→
Authenticate
→
Apply policy
→
Route
→
Measure
→
Models
  • ▸Authenticates the caller, ideally with Microsoft Entra ID rather than a shared key.
  • ▸Applies policy: token budgets, rate limits, content safety, logging.
  • ▸Routes the request to the right backend: a PTU deployment, a pay-as-you-go deployment, another region, a self-hosted model on GPUs, or a different provider.
  • ▸Measures every token, so you can do chargeback and spot anomalies.

On Azure, the AI Gateway is built on Azure API Management (APIM), which now ships a dedicated set of LLM-aware policies. That's why this is more than "put an API gateway in front of it": a traditional API gateway counts requests, while an AI Gateway counts tokens, and in the LLM world tokens are money.

Key ideaAn AI Gateway doesn't replace your agent runtime or your application. It governs how AI is consumed, not where your apps run.
Picture

Seven Reasons You Need One (Before Your CFO Tells You)

1Cost control that works at the token level

A single runaway agent loop can burn through a month's budget in an afternoon. The llm-token-limit policy enforces tokens-per-minute limits and token quotas per consumer: per app, per team, per subscription key, or any custom key you define. Budgets stop being a spreadsheet and become enforcement.

2Chargeback and showback without guesswork

With llm-emit-token-metric, every request emits token metrics to Azure Monitor with your own dimensions (application ID, business unit, user). You get real numbers for FinOps conversations, and alerts when a workload's consumption suddenly jumps.

3Resilience across deployments and regions

Models get throttled (HTTP 429), regions have bad days, and PTU capacity is finite. APIM backend pools support priority and weighted load balancing, plus a circuit breaker that respects Retry-After. The classic pattern: PTU first → spill over to pay-as-you-go → fail over to a secondary deployment. Your applications see one endpoint and none of the failover logic.

4Consistent safety and guardrails

Instead of trusting every team to implement content moderation, the gateway can enforce it centrally with the llm-content-safety policy (backed by Azure AI Content Safety, including Prompt Shields for jailbreak and injection attempts). This matters most for models that don't come with Azure's built-in content filters, such as self-hosted open-source models or third-party providers.

5No more keys scattered across code

The gateway uses its managed identity to talk to Azure OpenAI and Foundry, so provider keys never leave the platform. Consumers authenticate to the gateway with Entra ID tokens. Rotating credentials or revoking a misbehaving app becomes one change in one place, not a hunt through twelve repos.

6Freedom to change models without breaking apps

Models get versioned, upgraded, and retired constantly. When apps call a logical model name on the gateway rather than a hard-coded deployment, the platform team can test a new version in non-production, then switch production routing without anyone redeploying their app.

7One place to govern tools and agents, not just models

The AI Gateway has grown beyond LLMs. APIM can now expose REST APIs as MCP servers, front existing MCP servers with OAuth and policies, and manage A2A (agent-to-agent) APIs. As agents start calling tools and each other across teams, you get the same authentication, throttling, and audit trail you already have for models.

Picture

The Reference Pattern: Hub, Spoke, and a Clear Line Between Them

The pattern I see working best in enterprise landing zones has three layers:

Layer Owns Examples
Landing Zone Hub Connectivity & security Azure Firewall, App Gateway + WAF, DNS, Bastion, Sentinel
AI Hub (dedicated subscription) AI governance AI Gateway (APIM), central model deployments, content safety, token analytics, model/tool registry
AI Workload spokes Execution Agent runtime, app code, AI Search, grounding data, workload-specific AI services

Some design decisions I recommend:

  • ▸Give the AI Gateway its own APIM instance in a dedicated AI platform subscription. Don't bolt it onto the enterprise APIM that serves your partner and business APIs: the scaling profile, blast radius, and ownership are different.
  • ▸Run separate non-production and production AI Hubs. Gateway policies and model upgrades are changes too, and they deserve a promotion path.
  • ▸Host shared LLM deployments centrally (especially PTUs) so capacity is planned once, not fragmented across fifteen subscriptions.
  • ▸Route spoke-to-hub traffic through the hub firewall. It crosses a subscription boundary, so treat it like one.

The Part Most Architectures Get Wrong: What Should Not Go Through the Gateway

It's tempting to put everything behind the gateway. Don't.

Traffic Through the AI Gateway? Why
LLM calls (chat, completions, embeddings) Yes, always Token cost, safety, routing: this is the gateway's reason to exist
Cross-team / shared MCP servers Yes Cross-boundary trust needs central auth and audit
External (third-party) MCP servers Yes, mandatory Credential isolation and an egress audit trail
Agent-to-agent calls across workloads or tenants Yes Governance at trust boundaries
Agent-to-agent calls within one workload No The gateway isn't a low-latency message bus
Local tools inside the workload No No governance value, only extra latency
AI Search, Document Intelligence, Speech, Translator No, by default No token economics, large payloads, streaming audio. Govern with Private Endpoints, RBAC, Managed Identity and Azure Policy instead
Real-time voice/video (WebRTC) Exception Proxy the session negotiation where possible; approve case by case
Rule of thumbMediate where governance adds value (tokens, trust boundaries, external parties). Go direct where it only adds latency.

What It Looks Like in Practice

Here's a trimmed-down inbound policy that captures the essentials: Entra ID auth, a per-app token budget, token metrics, managed identity to the backend, and a load-balanced backend pool.

<policies>
  <inbound>
    <base />
    <!-- 1. Authenticate the caller with Entra ID -->
    <validate-azure-ad-token tenant-id="{{tenant-id}}">
      <audiences>
        <audience>api://ai-gateway</audience>
      </audiences>
    </validate-azure-ad-token>

    <!-- 2. Token budget per calling application -->
    <llm-token-limit
        counter-key="@(context.Request.Headers.GetValueOrDefault("x-app-id","unknown"))"
        tokens-per-minute="20000"
        estimate-prompt-tokens="false"
        remaining-tokens-header-name="x-remaining-tokens" />

    <!-- 3. Emit token usage for chargeback -->
    <llm-emit-token-metric namespace="ai-gateway">
      <dimension name="AppId" value="@(context.Request.Headers.GetValueOrDefault("x-app-id","unknown"))" />
      <dimension name="API ID" />
    </llm-emit-token-metric>

    <!-- 4. No keys: gateway uses its managed identity -->
    <authentication-managed-identity resource="https://cognitiveservices.azure.com" />

    <!-- 5. PTU-first pool with PAYG spillover (priority + circuit breaker) -->
    <set-backend-service backend-id="llm-backend-pool" />
  </inbound>
</policies>

Add llm-content-safety and the semantic cache lookup/store policies on top as needed, and you have a production-grade baseline.

Not Only APIM: Open-Source AI Gateways Worth Knowing

APIM is the natural choice in an Azure landing zone, but the AI gateway pattern isn't tied to one product. Two open-source projects come up in almost every conversation I have with engineering teams, and they solve quite different problems.

LiteLLM: the open-source enterprise gateway

LiteLLM is one of the most widely adopted open-source AI gateways. You can use it as a Python SDK or run it as a proxy server (the gateway mode) that exposes 100+ providers, including Azure OpenAI, Foundry, Bedrock, Vertex AI, Anthropic, vLLM and NVIDIA NIM, behind a single OpenAI-compatible API. Gateway mode gives you most of the building blocks from this article:

  • ▸Virtual keys per team or project, so nobody holds a provider key
  • ▸Budgets and spend tracking per key, user, or team
  • ▸Load balancing and fallbacks across deployments and providers
  • ▸Guardrails, caching, and logging hooks, plus an admin UI
  • ▸MCP and A2A support for tool and agent traffic

Where it fits on Azure: a multi-cloud or multi-provider estate where the platform team wants a code-first, self-hosted gateway, or a workload that needs a provider APIM doesn't cover natively. Run it on AKS or Azure Container Apps inside a spoke with private networking, back it with Azure Database for PostgreSQL and Azure Managed Redis, and put it behind your Landing Zone ingress like any other workload.

Pattern I likeFor larger enterprises: APIM at the edge, LiteLLM behind it. APIM owns enterprise identity, WAF integration and the policies security teams already know; LiteLLM handles provider-specific translation and routing. Keep it to two layers: every extra hop adds latency and one more thing to operate.

OmniRoute: the developer's AI router

OmniRoute is a different kind of tool. It's an MIT-licensed, local-first gateway built for individual developers and coding tools such as Claude Code, Codex, Cursor, Cline and Copilot. You point your tools at one endpoint and OmniRoute handles:

  • ▸Quota-aware auto-fallback across tiers (subscription → API key → cheap → free), so you don't stop coding when one quota runs out
  • ▸Token compression that the project says cuts token use substantially on coding workloads
  • ▸A catalogue of hundreds of providers, including many free tiers
  • ▸MCP and A2A integration, and a desktop/PWA dashboard
Know where your prompts goIt's a great productivity tool for personal use, hackathons and experiments, but it's not an enterprise governance layer, and the project is honest about that: it keeps its own list of providers flagged as terms-of-service risks and notes that free tiers change frequently. When a request can fall back to a free third-party provider, you no longer control where your prompt (and your code) is processed or retained. For corporate code or regulated data, point developer tools at your governed gateway instead.

Quick comparison

Azure API Management LiteLLM (proxy) OmniRoute
Best for Enterprise AI platforms on Azure Multi-provider, code-first platform teams Individual developers and coding tools
Hosting Managed PaaS Self-hosted (containers / Kubernetes) Local, Docker, or desktop
Identity Entra ID, managed identity, OAuth Virtual keys, SSO/enterprise features Local keys and provider logins
Token budgets & chargeback Policies + Azure Monitor Built-in spend tracking and budgets Personal quota tracking
Network isolation VNet injection / private endpoints Whatever you build around it Not designed for it
Data residency control Strong (you choose the backends) Strong if you restrict providers Weak by design (free-tier fallback)
Who operates it Microsoft runs the service You run everything You, on your machine

My rule of thumb: for an Azure-first enterprise, start with APIM. Add LiteLLM when your provider mix or code-first requirements outgrow it. Use OmniRoute for personal productivity, never as the front door for company data. And whatever you self-host, treat it like any other critical dependency: pin versions, verify container images, and scan your supply chain.

Pitfalls I've Seen in the Field

  • ▸Using subscription keys as the only authentication. Keys identify a consumer; they shouldn't be your only control. Use Entra ID and disable local (key) auth on the model resources with Azure Policy.
  • ▸Semantic caching without scoping. A cache that ignores the user or tenant can serve one user's answer to another. Partition the cache, set TTLs, and turn it off for high-risk workloads.
  • ▸Logging full prompts with no access model. Prompts contain PII. Decide who can read the LLM logs and how long you keep them before you enable them.
  • ▸Treating the gateway as a single point of failure. If every AI workload depends on it, it needs availability zones, multi-unit scale and a DR runbook. Model-level failover is useless if the gateway itself is down.
  • ▸Forgetting data residency. A "Global" model deployment can process prompts outside your region. In a sovereign or regulated region, document each model, its deployment type and where it's processed. The gateway will route anywhere you tell it to, so it won't catch this for you.
  • ▸Forgetting streaming. Most chat UIs stream. Test token accounting, content safety and any masking logic with streaming turned on, not just in Postman.

Adoption Checklist

  • ✅Dedicated AI platform subscription with its own APIM instance (tier chosen for private networking and zone redundancy)
  • ✅Non-prod and prod AI Hubs with a promotion pipeline for policies and model mappings
  • ✅Entra ID for consumers, managed identity to backends, local auth disabled
  • ✅Token limits and quotas per application or team
  • ✅Token metrics feeding Azure Monitor dashboards and budget alerts
  • ✅Backend pools with priority routing and circuit breakers
  • ✅Content safety policy for models without built-in filters
  • ✅A clear list of what bypasses the gateway, and why
  • ✅LLM log retention and access model agreed with security and privacy
  • ✅An MCP and A2A onboarding process for shared and external tools

My Take

In 2023 the question was "which model should we use?" In 2026 it's "how do we let fifty teams use a dozen models, hundreds of tools and a growing number of agents safely, affordably and visibly?"

The AI Gateway is how you answer that without slowing anyone down. Build it early, keep it focused on governance rather than making it a proxy for everything, and your AI platform will scale with the business instead of against it.

Next in this series: AI networking on Azure, covering private endpoints, DNS, egress control for agents, and the subnet sizing mistakes that bite later.

References
AI gateway capabilities in Azure API Management
Access Foundry models through a gateway (Azure Architecture Center)
llm-token-limit policy
llm-emit-token-metric policy
llm-content-safety policy
Enable semantic caching for LLM APIs
Backends, load balancing and circuit breaker in APIM
Authenticate and authorize access to LLM APIs
Log LLM prompts, completions and token usage
Expose REST APIs as MCP servers
Secure MCP servers in APIM
Agent-to-agent (A2A) APIs in APIM
Configure AI Gateway in Microsoft Foundry
Bring your own model (via AI gateway) to Foundry Agent Service
Govern MCP tools by using an AI gateway
AI Gateway hands-on labs (GitHub)
Azure AI Landing Zones (GitHub)
LiteLLM (GitHub)
OmniRoute (GitHub)
0 Comments



Leave a Reply.

    Author

    Mohammad Al Rousan is a Microsoft Most Valuable Professional (MVP) in Azure, a cloud architect, and a recognized leader in enterprise AI and data platforms. With over a decade of hands-on experience, he specializes in designing and scaling secure, production-grade solutions across Azure AI, Databricks, and modern cloud-native architectures.

    Picture
    Picture
    Top 10 Microsoft Azure Blogs

    Archives

    September 2026
    June 2026
    May 2026
    April 2026
    March 2026
    February 2026
    June 2025
    May 2025
    April 2025
    February 2025
    January 2025
    December 2024
    November 2024
    October 2024
    September 2024
    July 2024
    June 2024
    May 2024
    April 2024
    February 2024
    September 2023
    August 2023
    May 2023
    November 2022
    October 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    May 2021
    February 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    June 2020
    April 2020
    January 2020
    July 2019
    June 2019
    May 2019
    February 2019
    January 2019

    Categories

    All
    AKS
    Azure
    Beginner
    CDN
    DevOps
    End Of Support
    Fundamentals
    Guide
    Hybrid
    License
    Migration
    Network
    Security
    SQL
    Storage
    Virtual Machines
    WAF

    RSS Feed

    Follow
    Free counters!
Powered by Create your own unique website with customizable templates.