Mastra is a TypeScript agent framework. Use the @ai-sdk/openai provider with the AIgateway base URL and every model in our catalog becomes a Mastra-compatible agent brain.
Use Mastra's Agent class with @ai-sdk/openai pointed at AIgateway.
import { Agent } from "@mastra/core/agent"; import { openai } from "@ai-sdk/openai"; const agent = new Agent({ name: "researcher", model: openai("anthropic/claude-opus-4.7", { baseURL: "https://api.aigateway.sh/v1", }), });