AI Gateway

by Azure-Samples

952 stars
814 downloads
Not rated
GitHub Website

About

Labs to explore AI Models, MCP servers, and Agents with the AI Gateway powered by Azure API Management and Microsoft Foundry πŸš€

Details

Author
Azure-Samples
GitHub stars
952
Downloads
814
Categories
Other

- πŸ” Security via OAuth 2.0, managed identities, and content safety filtering
- ⚑ Performance with load balancing, semantic caching, and request routing
- πŸ“Š Observability through token metrics, built-in logging, and tracing
- πŸ’° Cost control using rate limiting, quota management, and FinOps framework
- πŸ”Œ Extensibility with MCP protocol support, function calling, and multi-model routing
- πŸ›οΈ Labs follow Azure Well-Architected Framework pillars (security, reliability, performance, operations, cost)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name AI Gateway
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install Python 3.12+ and uv, open the notebooks in VS Code with the Jupyter extension, and follow step-by-step instructions. Each lab deploys to your Azure subscription using provided Bicep templates and APIM policies.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "ai gateway": {
            "AI-Gateway": {
                "command": "uv",
                "args": [
                    "sync"
                ]
            }
        }
    }
}

McpServers

{
    "AI-Gateway": {
        "command": "uv",
        "args": [
            "sync"
        ]
    }
}

✨ AI Gateway Labs

Open Source GitHub Stars Open in GitHub Codespaces

AI-Gateway Labs

Explore the enterprise-grade gateway for managing AI Models, Tools, and Agents

<br/>

AI-Gateway flow

Azure

</div>

> πŸ“° New! The AI Gateway Dev Portal is now live β€” A starting point for building your own developer portal on top of Azure API Management AI Gateway's. Fork it, open it in VS Code with GitHub Copilot (or any coding agent), and shape it to fit your needs!

Why AI Gateway?

Building production-ready AI applications requires more than just calling model APIs. You need security, reliability, observability, and cost controlβ€”without slowing down innovation.

AI Gateway powered by Azure API Management provides:

- πŸ” Security β€” OAuth 2.0, managed identities, content safety filtering
- ⚑ Performance β€” Load balancing, semantic caching, request routing
- πŸ“Š Observability β€” Token metrics, built-in logging, tracing
- πŸ’° Cost Control β€” Rate limiting, quota management, FinOps framework
- πŸ”Œ Extensibility β€” MCP protocol support, function calling, multi-model routing

πŸ“š Explore the Labs

> πŸ”— Browse all 30+ labs at aka.ms/ai-gateway/labs

Each lab is a hands-on Jupyter notebook with step-by-step instructions, Bicep infrastructure templates, and APIM policies you can deploy to your Azure subscription.

🧠 AI Gateway for Models

Manage and control access to Large Language Models with enterprise-grade policies.

| Lab | Description |
|-----|-------------|
| Backend Pool Load Balancing | Distribute requests across multiple model endpoints |
| Token Rate Limiting | Control token consumption with rate limiting policies |
| Semantic Caching | Cache responses using vector similarity for faster, cheaper completions |
| Model Routing | Route requests to different backends based on model and version |
| FinOps Framework | Manage AI budgets with automated quota controls |

πŸ”§ AI Gateway for Tools

Enable secure tool access with MCP protocol and function calling capabilities.

| Lab | Description |
|-----|-------------|
| Model Context Protocol (MCP) | Plug & play tools with OAuth credential management |
| MCP Client Authorization | Implement MCP with the client authorization flow |
| Function Calling | Use OpenAI function calling with Azure Functions backend |
| Realtime Audio + MCP | Combine realtime voice API with MCP tools |

πŸ€– AI Gateway for Agents

Build and control agentic applications with orchestration frameworks.

| Lab | Description |
|-----|-------------|
| AI Agent Service | Explore Foundry Agent Service with multi-service control |
| OpenAI Agents SDK | Use OpenAI Agents with Azure OpenAI and APIM-managed tools |
| Gemini MCP Agents | Integrate Google Gemini models with MCP tools |
| A2A Enabled Agents | A2A-enabled Agents with models and MCP plug & play tools |

πŸš€ Quick Start

Prerequisites

- Python 3.12+
- uv (fast Python package manager) β€” install via curl -LsSf https://astral.sh/uv/install.sh | sh (Linux/macOS) or powershell -c "irm https://astral.sh/uv/install.ps1 | iex" (Windows)
- VS Code with Jupyter extension
- Azure Subscription with Contributor + RBAC Administrator roles
- Azure CLI authenticated to your subscription

Get Started

```bash

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.