Client
Memtro for Vercel AI SDK
One createOpenAICompatible call puts Memtro behind any AI SDK app; the MCP client adds its tools.
The AI SDK's OpenAI-compatible provider needs only a name, a base URL and a key, after which generateText and streamText run on Memtro with routing, memory and connector tools behind every call. For an agent that calls Memtro's tools itself, the @ai-sdk/mcp client connects to Memtro's Streamable HTTP endpoint and hands the tools to whichever model you run.
What you get
- createOpenAICompatible({ baseURL: 'https://platform.memtro.com/v1' }) with auto, memtro, auto:agent or any provider/model id
- Streaming, tool calls you execute, and the memtro field on non-streamed replies
- createMCPClient over Streamable HTTP so your own agent calls memory and connector tools
- Works wherever the SDK does: Next.js route handlers, Node, the edge runtime
How to connect
- 01npm i ai @ai-sdk/openai-compatible — and @ai-sdk/mcp @modelcontextprotocol/sdk for the tools
- 02const memtro = createOpenAICompatible({ name: 'memtro', baseURL: 'https://platform.memtro.com/v1', apiKey: process.env.MEMTRO_API_KEY })
- 03const { text } = await generateText({ model: memtro('auto'), prompt: 'Who owns the billing migration?' })
- 04const mcp = await createMCPClient({ transport: new StreamableHTTPClientTransport(new URL('https://platform.memtro.com/api/mcp'), { requestInit: { headers: { Authorization: 'Bearer sk-memtro-…' } } }) }); then tools: await mcp.tools()
Example queries
- › Who owns the billing migration?
- › memtro('auto:agent') for a multi-step answer with every relevant system checked
Why it is better with memory
Through Vercel AI SDK you get the same memory, connector tools, routing and jobs as every other client, so what one person learns in one tool is available to the whole team in all of them.