Built from the official docs: raw.githubusercontent.com · checked 25 November 2026
Local Python (no API key)
Install the package
Install the local build with pip. The local option needs Python 3.12 or 3.13 and an OpenAI key.
pip install 'membase-ai[local]'Set your OpenAI key
The local install reads OPENAI_API_KEY from the environment. Replace the placeholder with your own key.
export OPENAI_API_KEY=<your-openai-api-key>Add and search a memory in Python
Create a local client, add a fact, then search it. Local memory lives in ~/.membase and answers the same routes as hosted.
from membase import Membase m = Membase(local=True) # local, in ~/.membase m.memories.add("We picked Postgres for the ledger service.") # a fact m.search("what database is the ledger on?") # {"items": [...], "partial": [...]}Or use the command line
The same package gives you the membase command. Use --local before the command to run against your local store.
membase --local add "We picked Postgres for the ledger" membase --local search "what did we pick for the ledger?" membase --local ask "Which database is the ledger on?"
Check it worked
Running the search or ask command returns a result referencing the fact you added (for example, that the ledger is on Postgres); the Python search returns an object shaped like {items, has_more, partial}.