Has anyone used ChatGPT API and built context storage/retrieval separately?

I’m specifically looking at replicas of their conversation/message/user id structure when using the APIs itself. Let’s say I use pgvector/pinecone as a database and store the context there while using OpenAI to use the summary or compressed summary to generate new conversations based on stored conversations