Artificial intelligence news.
Straight from the original announcements.

Mastra Adds Private Model Gateways for Self-Hosted AI Agents

November 12, 2026By the AI News Bites Editorial TeamSource: Mastra
Mastra Adds Private Model Gateways for Self-Hosted AI Agents
Image: Mastra

Mastra has introduced private model gateways that let agents route requests to self-hosted open-weight models through a custom gateway. The feature can connect Mastra agents to local services such as Ollama, while allowing teams to control which models appear in Studio.

Key points
  • Mastra agents can route requests to self-hosted open-weight models through custom gateways.
  • The example connects Ollama and gpt-oss:20b through a local OpenAI-compatible API.
  • Model references use the gateway, provider and model format.
  • AUTO_BLOCK_EXTERNAL_PROVIDERS=true hides external providers in Studio.
  • The feature requires @mastra/[email protected] or later.

Routing agent requests to private models

Private model gateways add a configurable layer between Mastra agents and the models they use. Developers assign a gateway an ID, then reference the model with a gateway, provider and model path such as private/ollama/gpt-oss:20b.

Mastra's example uses Ollama and gpt-oss:20b. Running ollama serve starts an OpenAI-compatible API at http://localhost:11434/v1. A research agent in Studio can then run on the local model through the gateway, with Ollama logs showing requests arriving locally. In the example described by Mastra, the agent answers with a guide to deploying the model on AWS.

How developers configure a gateway

To use the feature, developers install the latest @mastra/core and an AI SDK provider for the gateway API. Mastra specifies @ai-sdk/[email protected] for the example and says the feature requires @mastra/[email protected] or later. The capability was added in PR #18153.

A gateway definition includes an ID and display name, plus functions for returning available providers and models, building the model-call URL, supplying an API key and resolving the language model for each request. The example registers a gateway called private, exposes Ollama and gpt-oss:20b, and points requests to the local Ollama endpoint.

After registration in the Mastra instance, an agent can select the model with the path private/ollama/gpt-oss:20b. The gateway example leaves the API key empty because the local model does not require one.

Compliance, cost and Studio controls

Mastra says hosted provider services can complicate HIPAA or GDPR compliance unless data retention agreements are in place. Self-hosting removes the third party from the setup, preventing sensitive data from reaching models outside the network. The company also says costs may be reduced because users pay for infrastructure rather than tokens, while retaining control over the models available to their agents.

Teams can prevent external providers from appearing in Studio's model picker by setting AUTO_BLOCK_EXTERNAL_PROVIDERS=true in their .env file. Mastra lists custom gateways as useful for showing only custom gateways in Studio, gateway-owned authentication and model pricing. For users, the feature provides a way to run supported agents against locally managed models instead of relying on external model providers, where the deployment and infrastructure are controlled by their own team.

Related news

Google Cloud adds unified observability for BigQuery and Looker AI agents
Products and toolsNovember 13, 2026, 18:00

Google Cloud adds unified observability for BigQuery and Looker AI agents

Google Cloud is expanding AI agent observability and evaluation across its Data Cloud, giving teams a shared way to monitor first-party agents in BigQuery and Looker…

Block brings people and AI agents together with Buzz and Unity Gateway
Products and toolsNovember 12, 2026, 15:59

Block brings people and AI agents together with Buzz and Unity Gateway

Block is using its open source Buzz workspace and Databricks Unity Gateway to let employees collaborate with AI agents, colleagues, and multiple AI models in one…

Vercel Adds Kimi K3.1 Pro to Token Pass for Pro Teams
Products and toolsNovember 12, 2026

Vercel Adds Kimi K3.1 Pro to Token Pass for Pro Teams

Vercel has added Moonshot AI's Kimi K3.1 Pro to Token Pass, its Early Access subscription for Pro teams using coding agents through AI Gateway. The model supports…