Menu
Important
Stay updated on React2Shell

Mastra

Last updated September 24, 2025

Mastra is a framework for building and deploying AI-powered features using a modern JavaScript stack powered by the Vercel AI SDK. Integrating with AI Gateway provides unified model management and routing capabilities.

  1. First, create a new Mastra project using the CLI:

    During the setup, the system prompts you to name your project, choose a default provider, and more. and more. Feel free to use the default settings.

  2. To use the AI Gateway provider, install the package along with Mastra:

  3. Create or update your file with your Vercel AI Gateway API key:

  4. Now, swap out the package (or your existing model provider) for the package.

    Update your agent configuration file, typically to the following code:

  5. Since your agent is now configured to use AI Gateway, run the Mastra development server:

    Open the Mastra Playground and Mastra API to test your agents, workflows, and tools.


Was this helpful?

supported.