A working AI chatbot that remembers users across sessions. OpenAI GPT-4o + persistent memory. Clone and deploy in 5 minutes.
👉 Want to add memory to your own app? See CLAIV Memory — the memory API powering this chatbot.
Without memory:
User: My name is Alex and I run a fitness business.
...next session...
AI: How can I help you today?
With memory:
AI: How is your fitness business going, Alex?
This is a full, working chatbot that remembers users using CLAIV Memory — not chat history, not a vector database, but structured persistent memory that works across sessions.
Most chatbot starters use chat history or session state. That means:
- The AI forgets everything when the session ends
- Long conversations hit token limits and get truncated
- Users have to repeat themselves
This chatbot uses persistent memory:
- Facts are extracted and stored after each turn
- Memory survives across sessions, devices, and restarts
- Only relevant context is injected — no token waste
git clone https://github.com/Claiv-Memory/ai-chatbot-with-memory
cd ai-chatbot-with-memory
npm install
cp .env.example .env.local
npm run devOpen http://localhost:3000.
OPENAI_API_KEY= # from platform.openai.com
CLAIV_API_KEY= # from claiv.io
User sends message
↓
GET /api/chat
↓
claiv.recall() — fetch what CLAIV knows about this user
↓
Inject memory.llm_context.text into system prompt
↓
OpenAI GPT-4o streams the response
↓
claiv.ingest() — store both turns for next time
The key file is src/app/api/chat/route.ts — under 40 lines.
- Next.js 14 — React framework
- Vercel AI SDK — streaming UI
- OpenAI GPT-4o — language model
- CLAIV Memory — persistent memory layer
One click with Vercel:
Set OPENAI_API_KEY and CLAIV_API_KEY in the Vercel dashboard.
See template-document-rag-nextjs — adds drag-and-drop document upload so your AI can answer questions about uploaded files.
- template-openai-nodejs — plain Node.js
- template-openai-python — Python
- template-langchain — LangChain
- claiv-memory — all examples
Keywords: ai chatbot with memory, chatbot that remembers users, openai chatbot persistent memory, nextjs ai chatbot, chatbot long term memory, ai that remembers, llm memory, chatbot context across sessions, openai memory nextjs
⭐ If this saves you time, give it a star — it helps other developers find it.