Models and providers
Ollama, OpenAI, or any OpenAI-compatible endpoint, for completions and embeddings.
Memnest uses models for two jobs, and they can come from different providers. Neither is required to start.
| Model | Used for | Without it |
|---|---|---|
| Completion | Extracting facts from conversations, resolving them against what is known, writing profiles, optional reranking | Direct writes and keyword search still work; raw text is stored but no facts are extracted |
| Embedding | Semantic recall: finding a fact worded differently from the question | Search runs on keywords only and the trace says lexical-only |
Configure
export MEMNEST_PROVIDER=ollama
export MEMNEST_COMPLETION_MODEL=llama3.1:8b # embeddings default to nomic-embed-textEverything stays on your machine. Memnest uses Ollama's native API, which constrains output to the JSON schema, so extraction is more reliable than through its /v1 route.
export OPENAI_API_KEY=sk-...
export MEMNEST_COMPLETION_MODEL=gpt-4.1-mini # embeddings default to text-embedding-3-smallexport MEMNEST_BASE_URL=http://localhost:1234/v1 # LM Studio, vLLM, Groq, OpenRouter, Together… export MEMNEST_API_KEY=... # if the endpoint needs one export MEMNEST_COMPLETION_MODEL=my-model
If the endpoint supports JSON mode but not strict schemas, set MEMNEST_STRUCTURED_OUTPUT=json_object.
# A hosted model for completions, local embeddings that never leave the machine
export MEMNEST_BASE_URL=https://api.groq.com/openai/v1 MEMNEST_API_KEY=...
export MEMNEST_COMPLETION_MODEL=my-model
export MEMNEST_EMBEDDING_PROVIDER=ollama MEMNEST_EMBEDDING_MODEL=nomic-embed-textVoyage is also supported for embeddings (VOYAGE_API_KEY).
memnest providers check # calls both endpoints: structured output and embedding dimensions memnest providers env # every variable Memnest reads
In code
import { ollamaCompletion, openAICompatibleEmbeddings } from '@memnest/providers'; const memnest = createMemnest({ store, queue: store.jobQueue(), completion: ollamaCompletion({ model: 'llama3.1:8b' }), embedder: openAICompatibleEmbeddings({ baseURL: 'http://localhost:1234/v1', model: 'my-embed', dimensions: 1024 }), });
Providers are a port, not a dependency: anything implementing CompletionProvider or EmbeddingProvider works, including your own wrapper around a model Memnest has never heard of.
Choosing a completion model
Extraction and resolution ask for small, strictly-shaped JSON, not prose. A local 8B model handles it. What matters is reliable structured output: schema-constrained decoding (Ollama's native API, OpenAI's strict mode) beats a larger model that returns malformed JSON. Malformed output is retried once and then treated as new, so the graph is never corrupted, but relations get missed.
The dimension lock
The first embedding write records the provider id and dimensions on the container. Writes or queries from a different provider fail with an error naming both, rather than silently comparing incompatible vectors. To change embedding model, use a new container, or re-embed everything:
memnest backfill --container user:123 # embeds memories and chunks that have no vectors yetCost and privacy
- One call per session, not per message. Batched extraction waits for a conversation to go quiet, then runs once.
- Resolution calls are skipped when nothing similar is stored, or the text matches exactly.
- Recall costs nothing unless you switch reranking on: retrieval, fusion and packing are all local.
- Fully local is a supported setup, not an afterthought: Ollama plus SQLite or Postgres means no data leaves your infrastructure.