Source profileQuality 90/100Review permissions

mem0ai/mem0/skills/mem0-vercel-ai-sdk/SKILL.md

mem0-vercel-ai-sdk

Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also triggers for Next.js apps needing memory-augmented AI. DO NOT TRIGGER when: user asks about direct Python/TS SDK calls without Vercel (use mem0 skill), or CLI terminal commands (use

Source repository stars
62,498
Declared platforms
0
Static risk flags
1
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

Memory-enhanced AI provider for Vercel AI SDK. Automatically retrieves and stores memories during LLM calls.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/mem0ai/mem0 --skill "skills/mem0-vercel-ai-sdk"
    Safe inspection promptEditorial

    Inspect the Agent Skill "mem0-vercel-ai-sdk" from https://github.com/mem0ai/mem0/blob/b54710a3c3b9060971b288197aee87efa3cc4d98/skills/mem0-vercel-ai-sdk/SKILL.md at commit b54710a3c3b9060971b288197aee87efa3cc4d98. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Step 1: Install

      Review the “Step 1: Install” section in the pinned source before continuing.

      Review and apply the “Step 1: Install” source section.
    2. 02

      Step 2: Set up environment variables

      Get a Mem0 API key at: https://app.mem0.ai/dashboard/api-keys?utmsource=oss&utmmedium=skill-mem0-vercel-ai-sdk

      Get a Mem0 API key at: https://app.mem0.ai/dashboard/api-keys?utmsource=oss&utmmedium=skill-mem0-vercel-ai-sdk
    3. 03

      Pattern 1: Wrapped Model

      The wrapped model approach is the simplest. createMem0 returns a provider that wraps any supported LLM with automatic memory retrieval and storage.

      The prompt is sent to Mem0 search (POST /v3/memories/search/) to retrieve relevant memoriesRetrieved memories are injected as a system message at the start of the promptThe underlying LLM (e.g., OpenAI gpt-5-mini) generates a response using the enriched prompt
    4. 04

      Pattern 2: Standalone Utilities

      Use standalone utilities when you want full control over the memory retrieve/store cycle, or you want to use a provider that is already configured separately.

      Use standalone utilities when you want full control over the memory retrieve/store cycle, or you want to use a provider that is already configured separately.
    5. 05

      Pattern 3: Streaming

      Use streamText for streaming responses with memory augmentation:

      Use streamText for streaming responses with memory augmentation:The wrapped model handles memory retrieval before streaming begins and stores the conversation after.

    Permission review

    Static risk signals and limitations

    Runs scripts

    medium · line 9

    The documentation asks the agent to run terminal commands or scripts.

    npm install @mem0/vercel-ai-provider ai

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score90/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars62,498SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    mem0ai/mem0
    Skill path
    skills/mem0-vercel-ai-sdk/SKILL.md
    Commit
    b54710a3c3b9060971b288197aee87efa3cc4d98
    License
    Apache-2.0
    Collected
    2026-08-04
    Default branch
    main
    View the original SKILL.md

    Mem0 Vercel AI SDK Provider

    Memory-enhanced AI provider for Vercel AI SDK. Automatically retrieves and stores memories during LLM calls.

    Step 1: Install

    npm install @mem0/vercel-ai-provider ai
    

    Step 2: Set up environment variables

    export MEM0_API_KEY="m0-xxx"
    export OPENAI_API_KEY="sk-xxx"   # or ANTHROPIC_API_KEY, GOOGLE_API_KEY, etc.
    

    Get a Mem0 API key at: https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=skill-mem0-vercel-ai-sdk

    Pattern 1: Wrapped Model

    The wrapped model approach is the simplest. createMem0 returns a provider that wraps any supported LLM with automatic memory retrieval and storage.

    import { generateText } from "ai";
    import { createMem0 } from "@mem0/vercel-ai-provider";
    
    const mem0 = createMem0();
    const { text } = await generateText({
      model: mem0("gpt-5-mini", { user_id: "alice" }),
      prompt: "Recommend a restaurant",
    });
    

    What happens under the hood:

    1. The prompt is sent to Mem0 search (POST /v3/memories/search/) to retrieve relevant memories
    2. Retrieved memories are injected as a system message at the start of the prompt
    3. The underlying LLM (e.g., OpenAI gpt-5-mini) generates a response using the enriched prompt
    4. The conversation is stored back to Mem0 (POST /v3/memories/add/) as a fire-and-forget async call (no await)

    Pattern 2: Standalone Utilities

    Use standalone utilities when you want full control over the memory retrieve/store cycle, or you want to use a provider that is already configured separately.

    import { openai } from "@ai-sdk/openai";
    import { generateText } from "ai";
    import { retrieveMemories, addMemories } from "@mem0/vercel-ai-provider";
    
    const prompt = "Recommend a restaurant";
    
    // Retrieve memories -- returns a formatted system prompt string
    const memories = await retrieveMemories(prompt, {
      user_id: "alice",
      mem0ApiKey: "m0-xxx",
    });
    
    // Generate using any provider with injected memories
    const { text } = await generateText({
      model: openai("gpt-5-mini"),
      prompt,
      system: memories,
    });
    
    // Optionally store the conversation back
    await addMemories(
      [
        { role: "user", content: [{ type: "text", text: prompt }] },
        { role: "assistant", content: [{ type: "text", text }] },
      ],
      { user_id: "alice", mem0ApiKey: "m0-xxx" }
    );
    

    Pattern 3: Streaming

    Use streamText for streaming responses with memory augmentation:

    import { streamText } from "ai";
    import { createMem0 } from "@mem0/vercel-ai-provider";
    
    const mem0 = createMem0();
    const result = streamText({
      model: mem0("gpt-5-mini", { user_id: "alice" }),
      prompt: "What should I cook for dinner?",
    });
    
    for await (const chunk of result.textStream) {
      process.stdout.write(chunk);
    }
    

    The wrapped model handles memory retrieval before streaming begins and stores the conversation after.

    Supported Providers

    ProviderConfig valueRequired env var
    OpenAI (default)"openai"OPENAI_API_KEY
    Anthropic"anthropic"ANTHROPIC_API_KEY
    Google"google"GOOGLE_GENERATIVE_AI_API_KEY
    Groq"groq"GROQ_API_KEY
    Cohere"cohere"COHERE_API_KEY

    Select a provider when creating the Mem0 instance:

    const mem0 = createMem0({ provider: "anthropic" });
    const { text } = await generateText({
      model: mem0("gpt-5-mini", { user_id: "alice" }),
      prompt: "Hello!",
    });
    

    How It Works Internally

    Wrapped model flow

    User prompt
      --> searchInternalMemories (POST /v3/memories/search/)
      --> memories injected as system message at start of prompt
      --> underlying LLM generates response (doGenerate or doStream)
      --> processMemories fires addMemories as fire-and-forget (no await)
      --> response returned to caller
    

    Standalone flow

    User controls each step:
      1. retrieveMemories / getMemories / searchMemories -> fetch memories
      2. inject into system prompt manually
      3. call generateText / streamText with any provider
      4. addMemories -> store new conversation to Mem0
    

    Key Differences Between the 4 Utility Functions

    FunctionReturnsUse when
    retrieveMemoriesFormatted system prompt stringInjecting directly into system parameter
    getMemoriesRaw memory arrayProcessing memories programmatically
    searchMemoriesFull search response (results + relations)Need relations, scores, metadata
    addMemoriesAPI responseStoring new messages to Mem0

    All four accept LanguageModelV2Prompt | string as the first argument and optional Mem0ConfigSettings as the second.

    Common Edge Cases and Tips

    • Always provide user_id (or agent_id/app_id/run_id) for consistent memory retrieval. Without an entity identifier, memories cannot be scoped.
    • Standalone utilities require explicit API key: pass mem0ApiKey in the config object, or set the MEM0_API_KEY environment variable.
    • This uses Vercel AI SDK v5 (LanguageModelV2 / ProviderV2 interfaces). It is not compatible with AI SDK v3 or v4.
    • processMemories fires addMemories as fire-and-forget (.then() without await). Memory storage happens asynchronously and does not block the LLM response.
    • The "gemini" alias exists in the provider switch but is NOT in the supportedProviders list. Use "google" instead.
    • Custom host: set host in the config to point to a different Mem0 API endpoint (default: https://api.mem0.ai).

    References

    TopicFile
    Provider API (createMem0, Mem0Provider, types)local / GitHub
    Memory utilities (addMemories, retrieveMemories, etc.)local / GitHub
    Usage patterns and exampleslocal / GitHub

    Related Mem0 Skills

    SkillWhen to useLink
    mem0Python/TypeScript SDK, REST API, framework integrationslocal / GitHub
    mem0-cliTerminal commands, scripting, CI/CD, agent tool loopslocal / GitHub

    Alternatives

    Compare before choosing

    Computed 9123,781

    alirezarezvani/claude-skills

    code-to-prd

    Reverse-engineer any codebase into a complete Product Requirements Document (PRD). Analyzes routes, components, state management, API integrations, and user interactions to produce business-readable documentation detailed enough for engineers or AI agents to fully reconstruct every page and endpoint. Works with frontend frameworks (React, Vue, Angular, Svelte, Next.js, Nuxt), backend frameworks (NestJS, Django, Express, FastAPI), and fullstack applications. Use when users mention: generate PRD,

    Computed 9123,781

    alirezarezvani/claude-skills

    senior-fullstack

    Fullstack development toolkit with project scaffolding for Next.js, FastAPI, MERN, and Django stacks, code quality analysis with security and complexity scoring, and stack selection guidance. Use when the user asks to "scaffold a new project", "create a Next.js app", "set up FastAPI with React", "analyze code quality", "audit my codebase", "what stack should I use", "generate project boilerplate", or mentions fullstack development, project setup, or tech stack comparison.

    Computed 9179

    hookdeck/webhook-skills

    scrapfly-webhooks

    Receive and verify Scrapfly webhooks. Use when setting up Scrapfly webhook handlers for async scrape, extraction, screenshot, or crawler jobs, debugging X-Scrapfly-Webhook-Signature verification, or routing on X-Scrapfly-Webhook-Resource-Type.

    Computed 8979

    hookdeck/webhook-skills

    hookdeck-event-gateway-webhooks

    Verify and handle webhooks delivered through the Hookdeck Event Gateway. Use when receiving webhooks via Hookdeck and need to verify the x-hookdeck-signature header. Covers signature verification for Express, Next.js, and FastAPI.