Model Providers
Mastra’s unified model router gives you access to 626+ models from 45 providers with a single API. Switch between models and providers without installing packages.
import { Agent } from "@mastra/core";
const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "openai/gpt-4o" // Works with any provider/model
});
Comes with environment variable detection to handle authentication, and full TypeScript support to autocomplete models directly in your editor.