Skip to content

feat: local OpenAI-compatible backend for mem0-local (zero API spend)#19

Merged
groksrc merged 1 commit into
mainfrom
feat/mem0-local-llm
Jun 12, 2026
Merged

feat: local OpenAI-compatible backend for mem0-local (zero API spend)#19
groksrc merged 1 commit into
mainfrom
feat/mem0-local-llm

Conversation

@groksrc

@groksrc groksrc commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Removes the hard OPENAI_API_KEY requirement from mem0-local. Backend priority:

  1. MEM0_OPENAI_COMPAT_BASE_URL (e.g. Ollama at http://localhost:11434/v1) — LLM + embeddings via mem0's openai provider against the local endpoint; per-run qdrant collections with matching dims (default nomic-embed-text/768) under MEM0_QDRANT_PATH.
  2. OPENAI_API_KEY — mem0 stock defaults, behavior unchanged.
  3. Neither — skipped, as before.

MEM0_INFER=true enables mem0's LLM fact-extraction at ingest (their recommended mode); default false preserves the June 10 baseline semantics. Backend, models, and infer mode land in version_info → run manifest, so every run records exactly how mem0 was configured.

Why

Zero-API-spend benchmark runs (program decision), and fairness transparency: when we publish comparisons, reviewers can verify mem0's configuration from the manifest rather than trusting prose.

Verification

  • 3 new unit tests (config shape incl. qdrant-safe run-scoped collection naming, skip behavior, infer flag).
  • Live smoke against Ollama (qwen2.5:3b + nomic-embed-text): both infer modes ingest, search ranks the correct doc first with sane scores, cleanup works, zero external API calls.
  • Full suite green (74 passed), lint clean.

🤖 Generated with Claude Code

mem0-local previously hard-required OPENAI_API_KEY, putting paid API
calls inside the benchmark loop. It now picks a backend in priority
order:

1. MEM0_OPENAI_COMPAT_BASE_URL (e.g. Ollama at localhost:11434/v1) —
   LLM and embeddings both route there via mem0's openai provider; the
   qdrant store is created per-run with matching dimensions
   (default nomic-embed-text, 768) under MEM0_QDRANT_PATH. Collection
   names are run-scoped because qdrant rejects dim changes within a
   collection.
2. OPENAI_API_KEY — mem0's stock defaults, unchanged.
3. Neither — ProviderSkippedError, as before.

MEM0_INFER=true switches ingest from raw add to mem0's LLM
fact-extraction (its recommended/headline mode); default false matches
the existing June 10 baseline semantics. Backend, models, and infer
mode are recorded in version_info so every run manifest shows exactly
how mem0 was configured — fairness reviewers can see it wasn't
hobbled or boosted.

Smoke-verified against live Ollama (qwen2.5:3b + nomic-embed-text):
both infer modes ingest, search ranks the correct doc first, cleanup
works, zero external API calls.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
@groksrc groksrc merged commit 23c5b87 into main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant