Mastra 推出 Mastra Gateway,以單一 API key 接入超過 500 款模型
Announcing Mastra Gateway
Mastra 推出 Mastra Gateway,讓用戶以單一 API key 存取超過 500 款模型,並以一張帳單管理用量。每個模型由多家推理供應商支援,主要路由失效或表現不佳時會自動切換;用戶亦可為每個 key 設定支出上限、可用模型及美國或歐盟的區域限制。平台亦提供推理追蹤、模型比較實驗,以及跨應用的效能和成本追蹤;截至 2026 年 12 月 31 日,推理支出不收信用卡手續費。
Today we’re rolling out the Mastra Gateway, where you can access hundreds of the latest models from all the top providers including Anthropic, OpenAI, Typesafe AI and more.
With one key and one bill, you can build your entire AI product suite on the Mastra platform with powerful controls at the key level.
Over the last two years, the Mastra model router has helped teams scale up their AI applications, and it now runs tens of trillions of tokens every week. But every provider required its own key, and its own bill. The Mastra Gateway is built on that same model router, but hosted on the Mastra platform, with every provider available through a single key.
And importantly, it has failover built in. Each model is backed by multiple industry-grade inference providers, and if the primary route fails, we’ll automatically retry using another provider.
Get started
Head to the Mastra Gateway, create your first key, then add the key to your project's .env file:
MASTRA_GATEWAY_API_KEY=your-keyAdd the mastra/ gateway prefix to the model ID:
import { Agent } from "@mastra/core/agent";
export const agent = new Agent({
id: "assistant",
name: "Assistant",
instructions: "You are a helpful assistant.",
model: "mastra/anthropic/claude-fable-5.2"
});See the Mastra Gateway docs for setup, model strings, and Observational Memory.
Access over 500 models
With one key you and your agents can leverage frontier intelligence with a single API key.
The Mastra Gateway gives you access to the latest language, voice, video, and decision models to build powerful AI applications. We support frontier and open source models as well as a generous collection of free models. Browse the full list in the Gateway models page.
One powerful platform
With the Mastra Gateway embedded in the Mastra platform, you now get powerful observability baked into your model calls. Review traces for every inference call, run experiments that compare models, and track performance and costs across your entire AI application.
And with a single bill, you can now more easily understand your total spend across your suite of products and tools. You can use Mastra platform’s credits with auto-top-up to ensure that your agents have access to the level of intelligence they need for any task.
Admin controls per key
In the Mastra Gateway, when creating a new key you can control both the spend and the allowed models for your team and agents. Set hourly, daily, weekly, monthly, or even lifetime spend limits, and choose which models the key can call, ensuring that your team has access to the right kind of intelligence for the task at hand.
Regions and high availability
In addition to spend and model controls, when creating a new key you can set a regional limit between the US and EU for when your data needs to live within a specific region.You can also directly route your traffic to our dedicated EU endpoint to ensure your AI applications are keeping prompts and user data within your specific region.
To ensure the highest availability, the Mastra Gateway is multi-provider by default. In the case that our primary provider is unavailable or under performing for a specific model, we’ll fallback safely to another provider to ensure that all requests are served quickly and successfully.
The Mastra Gateway is the model router your Mastra agents already use, now running on the Mastra platform next to your deploys, databases, and observability. Model access, spend, and usage all sit in the same place as the rest of your project.
As a special during our launch, we’ll be charging no credit card fees on inference spending until the end of the year, December 31, 2026.
And that's really it. Create a key and point your agents at the Mastra Gateway.
來源:Mastra Blog · mastra.ai