Examples
The Mastra Memory Gateway is compatible with any HTTP client or SDK that speaks the OpenAI or Anthropic protocol. These guides show how to connect popular SDKs and frameworks.
All examples assume you have a Mastra account and an API key (prefix msk_). Visit the Quickstart to get set up.
TypeScript
Anthropic SDK
Use the official Anthropic TypeScript SDK for messages, streaming, and tool calling.
Deep Agents
Build a Deep Agents agent with planning, subagents, and persistent memory through the gateway.
LangGraph
Build a LangGraph agent with tool calling and persistent memory through the gateway.
OpenAI SDK
Use the official OpenAI TypeScript SDK for chat completions, streaming, tool calling, and the Responses API.
Vercel AI SDK
Use @ai-sdk/openai-compatible and @ai-sdk/anthropic with generateText, streamText, and tool calling.
Mastra Framework
Build a Mastra agent with a gateway model and server-enriched memory.