Skip to main content

Gateway Providers

Gateway providers aggregate multiple model providers and add features like caching, rate limiting, analytics, and automatic failover. Use gateways when you need observability, cost management, or simplified multi-provider access.

Custom gateways
Direct link to Custom gateways

Create custom gateways for private LLM deployments or specialized provider integrations. See Custom Gateways for implementation details.

Gateways you register yourself
Direct link to Gateways you register yourself

These gateways aren't registered by default. Pass them to new Mastra({ gateways }). Their model IDs only resolve for agents registered on that instance.

  • Azure OpenAI: Private Azure OpenAI deployments, registered with AzureOpenAIGateway

Built-in gateways
Direct link to Built-in gateways