The OpenAI memory gap
OpenAI added memory to ChatGPT for consumer users. The standard chat completions API has no equivalent. Each API call is stateless unless you send full conversation history.
Sending entire chat logs on every request burns tokens, increases latency, and still misses facts from older sessions that fell out of context.
Developers building GPT-4o, GPT-4, or GPT-3.5 apps need an external memory layer. Databaset fills that role with a simple store and recall API.
How to add memory to OpenAI apps
- After each user message, call memory.recall with the userId and query
- Inject recalled memories into the system message before calling OpenAI
- After the assistant responds, store durable new facts with memory.store
- Use metadata tags like source: openai-gpt4 for filtering and debugging
import OpenAI from "openai";
import { Databaset } from "@databaset/sdk";
const openai = new OpenAI();
const memory = new Databaset({ apiKey: process.env.DATABASET_API_KEY });
async function chat(userId: string, message: string) {
const { memories } = await memory.recall({ userId, query: message, limit: 5 });
const system = `You are a helpful assistant.
Known facts about this user:
${memories.map(m => "- " + m.text).join("\n")}`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{ role: "system", content: system },
{ role: "user", content: message },
],
});
const reply = completion.choices[0].message.content ?? "";
// Store new facts extracted from the exchange
await memory.store({ userId, text: message, metadata: { source: "openai" } });
return reply;
}Databaset vs OpenAI Assistants API threads
The Assistants API stores thread history, but it is tied to OpenAI's thread model, not portable semantic memory. Threads grow unbounded and lack per-fact recall.
Databaset gives you user-scoped semantic memory that works with any OpenAI model, any framework (Vercel AI SDK, LangChain, raw fetch), and any other LLM provider simultaneously.
Works with Vercel AI SDK and LangChain
Call memory.recall in your route handler or LangChain tool chain before streaming a response. Inject memories into the system prompt or as a tool result.
See docs.databaset.com for Node.js and Python SDK quickstarts with OpenAI examples.
Cost and limits
Databaset free tier: 3,000 API calls per month. Starter plan: 100K calls at $29/mo. You still pay OpenAI for model tokens separately.
Memory reduces OpenAI costs by sending fewer tokens per request compared to full history replay.
Frequently asked questions
- Does OpenAI offer a memory API for developers?
- Not as a standalone memory product. ChatGPT has consumer memory. API developers use threads, fine-tuning, or external memory services like Databaset.
- Which OpenAI models work with Databaset memory?
- All chat completion models: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo, and future models that accept text prompts.
- Can I migrate ChatGPT memory to my app?
- ChatGPT memory is not exportable via API. Design your app to store facts with memory.store from day one so you own the data.
Start building with Databaset
Add persistent AI memory in minutes. Free tier includes 3,000 API calls per month. No credit card required.