mem0-vercel-ai-sdk
Skill by mem0ai
Mem0 provider for the Vercel AI SDK that retrieves and stores memories during LLM calls. It is for developers building memory-enhanced AI features in Next.js or other TypeScript apps using AI SDK v6.
Install mem0-vercel-ai-sdk
Built from the published package, never by AI.
git clone --depth 1 https://github.com/mem0ai/mem0 /tmp/mem0 && mkdir -p ~/.claude/skills && cp -r /tmp/mem0/skills/mem0-vercel-ai-sdk ~/.claude/skills/mem0-vercel-ai-sdkRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/mem0ai/mem0 /tmp/mem0 && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/mem0/skills/mem0-vercel-ai-sdk ~/.gemini/antigravity-cli/skills/mem0-vercel-ai-sdkAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill documents the @mem0/vercel-ai-provider package, a memory provider for the Vercel AI SDK. The simplest pattern is a wrapped model created with createMem0. Before the LLM call, the provider stores the prompt to Mem0, searches for relevant memories, and injects any results as a system message. The underlying model, such as OpenAI, Anthropic, Google, Groq or Cohere, then generates the response. The skill also covers streamText for streaming, and standalone utilities (retrieveMemories, getMemories, searchMemories, addMemories) for manual control over the memory cycle.
The skill is aimed at developers who use generateText or streamText with Mem0 in Vercel AI SDK projects. It states that it targets AI SDK v6 and is not compatible with AI SDK v4 or earlier. Direct Python or TypeScript SDK calls without Vercel, and terminal CLI usage, are covered by other Mem0 skills.
Written from the project's SKILL.md and checked against it.
What it can do
- createMem0Creates a Mem0 provider that wraps supported LLMs with automatic memory retrieval and storage.
- Wrapped modelCalls mem0(model, { user_id }) so each generation includes relevant memories as context.
- retrieveMemoriesReturns a formatted system prompt string containing relevant memories for the system parameter.
- getMemoriesReturns the raw memory array for programmatic processing.
- searchMemoriesReturns the raw search response, including scores and full metadata.
- addMemoriesStores new conversation messages to Mem0.
- streamText supportRetrieves memories before streaming begins and streams the response with memory augmentation.
- Memory source in generateTextAttaches a Mem0 Memories source with memories and memoriesText to the generateText result when memories are found.
- Provider selectionSupports OpenAI (default), Anthropic, Google (alias gemini), Groq and Cohere.
What you need
- Node.js 18 or later
- Mem0 API key (MEM0_API_KEY)
- API key for the chosen LLM provider, such as OPENAI_API_KEY
- Vercel AI SDK v6 (ai package ^6)
Try asking
- Use createMem0 to recommend a restaurant with memory for user alice
- Stream a dinner suggestion in my Next.js app with Mem0 memories
- Store this chat turn in Mem0 with addMemories for user alice
Good to know
- Each wrapped call makes one memory write and one memory search, so it adds two requests.
- If a Mem0 request fails, the error is logged and the LLM call continues without memories.
- Not compatible with Vercel AI SDK v4 or earlier. Provider 2.x targeted AI SDK v5.
- Several options were removed in 3.0.0, including org_id, project_id, async_mode and enable_graph.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/mem0-vercel-ai-sdk/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
LICENSE10 KB -
README.md3 KB -
SKILL.md9 KB -
references/memory-utilities.md11 KB -
references/provider-api.md10 KB
Show all 6 files
-
references/usage-patterns.md10 KB
Alternatives to mem0-vercel-ai-sdk
All alternatives →Set up and diagnose a local agentmemory installation. It covers MCP connections, environment variables, ports, auth and feature flags, and is for users getting started or checking a connection.
Analyzes a Karpathy-pattern LLM wiki and builds an interactive knowledge graph with entities, implicit links and topic clusters. Built for people who maintain LLM-generated markdown wikis.
Saves and loads timestamped reports for AI assistants, with keyword routing for fast lookup. It also runs an Actionability Gate that checks report links before delivery. Intended for morning briefings, meeting digests and research reports.
Removes a personal fact, preference, relationship detail, topic or past event from Muse's active memory. It also stops existing copies and automations from bringing it back.
Git Context Controller (GCC) is a skill that stores agent memory as a versioned file system under .GCC/. It suits multi-step projects that need milestone tracking, branching and context recovery across sessions.
Guides an evidence-first reading of a book, article, PDF or document set. Built for readers who want claims, evidence and recall rather than a short summary.
Compare with agentmemory-config, understand-knowledge or reports
mem0-vercel-ai-sdk: common questions
Does this work with AI SDK v4?
No. The source says it uses Vercel AI SDK v6 and is not compatible with AI SDK v4 or earlier.
Which LLM providers can it wrap?
The source lists OpenAI (default), Anthropic, Google (alias gemini), Groq and Cohere, selected with the provider option in createMem0.
What happens if the Mem0 API call fails?
The error is logged and the LLM call proceeds without memories, according to the source.
How do I install mem0-vercel-ai-sdk?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is mem0-vercel-ai-sdk free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is mem0-vercel-ai-sdk safe to use?
It scores 92 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to mem0-vercel-ai-sdk?
Similar skills: agentmemory-config, understand-knowledge, reports, forget.
