azure-aigateway

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

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/stephschofield/beth --skill azure-aigateway-stephschofield
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: azure-aigateway
Source: https://github.com/stephschofield/beth/tree/main/.github/skills/azure-aigateway
Command: npx skills add https://github.com/stephschofield/beth --skill azure-aigateway-stephschofield

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 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 filters to Azure OpenAI and AI Foundry backends. - Backend & Load Balancing Configuration: Add AI model backends with managed identity authentication and distribute traffic across multiple regions with retry logic. - MCP Tool Protection: Convert existing APIs into MCP tools with per-agent rate limiting and content filtering. - Use Case: You need to cap token spend per subscription while caching repeated prompts. Use this Skill to apply the azure-openai-token-limit and semantic cache policies to your APIM instance and verify with a test call. ## Quick Start Ask the agent to configure my Azure API Management instance as an AI gateway with token limits and semantic caching for my Azure OpenAI backend.

Frequently Asked Questions about azure-aigateway

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

FAQPage Schema
How do I set up Azure API Management as an AI gateway?▼

Create an APIM backend pointing to your Azure OpenAI endpoint, enable managed identity, grant the Cognitive Services User role, and import the OpenAI API specification. Then apply governance policies like token limits and semantic caching in the inbound section.

How do I limit token usage in Azure API Management?▼

Use the azure-openai-token-limit policy with a tokens-per-minute value and a counter-key such as the subscription ID. Requests exceeding the limit receive a 429 response, and you can expose remaining tokens via response headers.

Does semantic caching work with streaming responses in APIM?▼

No. Semantic caching with azure-openai-semantic-cache-lookup and store policies is not compatible with streaming requests where stream is set to true. Use non-streaming requests for cost-saving cache scenarios.

Why am I getting 401 errors from my Azure OpenAI backend through APIM?▼

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

How do I fix semantic cache misses in the AI gateway?▼

Lower the score-threshold from 0.9 toward 0.7 to increase matches, verify the embeddings backend URL and authentication, and confirm Azure Cache for Redis Enterprise with RediSearch is deployed for vector storage.

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 keyed on an agent ID header, optionally add content safety filtering, and generate an MCP manifest pointing to the APIM endpoint.