azure-aigateway

Configure Azure API Management as an AI Gateway for models, MCP tools, and agents.

Updated May 12, 2026
One-click install
npx skills add https://github.com/sohamda/apex-try-out-demo-repo --skill azure-aigateway-sohamda
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: azure-aigateway
Source: https://github.com/sohamda/apex-try-out-demo-repo/tree/main/.archive/_archived_skills/azure-aigateway
Command: npx skills add https://github.com/sohamda/apex-try-out-demo-repo --skill azure-aigateway-sohamda

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Governing AI model traffic—controlling token costs, caching responses, filtering harmful content, and load balancing across backends—requires complex Azure API Management policy configuration that is error-prone when done manually. ## Core Features & Use Cases - AI Governance Policies: Apply token rate limits, semantic caching, token usage metrics, and content safety policies to Azure OpenAI and AI Foundry backends. - Backend Configuration: Add AI model backends with managed identity authentication, load balance across regions, and convert APIs into MCP tools with rate limiting. - Troubleshooting Guidance: Diagnose 401 auth failures, 429 token limit errors, cache misses, and content safety false positives with step-by-step fixes. - Use Case: You need to cut Azure OpenAI costs and enforce per-tenant token limits. Use this Skill to configure semantic caching (60-80% savings) and per-subscription token-limit policies on your APIM gateway. ## Quick Start Ask the agent to add an Azure OpenAI backend to your API Management instance and apply token limiting and semantic caching policies.

Frequently Asked Questions about azure-aigateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Azure API Management as an AI Gateway?▼

Add your Azure OpenAI resource as an APIM backend with managed identity authentication, then apply inbound policies for token limits, semantic caching, and content safety. The patterns reference provides step-by-step Azure CLI commands for each stage.

How to reduce Azure OpenAI costs with semantic caching?▼

Apply the azure-openai-semantic-cache-lookup policy inbound and azure-openai-semantic-cache-store outbound with a score threshold around 0.8. This caches responses for similar prompts and can save 60-80% on repeated queries, but requires an embeddings backend and Redis with RediSearch.

Does semantic caching work with streaming AI responses?▼

No, semantic caching and token metrics policies are not compatible with streaming responses using stream: true. Use non-streaming requests for cost control scenarios that rely on caching.

Why does my AI gateway return 401 from the Azure OpenAI backend?▼

A 401 usually means managed identity is not enabled on APIM, the Cognitive Services User role is missing, or the authentication resource URL is wrong. Verify identity with az apim show, grant the role on the OpenAI resource, and wait 5-10 minutes for RBAC propagation.

How do I fix 429 token limit errors in API Management?▼

Increase the tokens-per-minute value in the azure-openai-token-limit policy, load balance across multiple regional backends, or enable semantic caching to reduce actual token consumption. You can also switch the counter-key to per-user to prevent one client exhausting the pool.

Can I convert an existing API into an MCP tool with APIM?▼

Yes, import the API into APIM using its OpenAPI specification, add rate-limit-by-key policies to protect the endpoint, and generate an MCP manifest pointing to the APIM endpoint. Content safety policies can filter harmful inputs to the tool.