Skip to main content
Run Cognee entirely on your own machine — no cloud API key required. The key rule is that both the LLM provider and the embedding provider must be configured together to use a local backend; configuring only one will cause the other to fall back to OpenAI. Before you start:
  • Complete Quickstart to understand basic operations
  • Install Ollama if using the Ollama options below
After switching to a local provider for the first time, call cognee.prune.prune_system(metadata=True) before running cognify to ensure there are no stale vector collections from the previous (OpenAI) embedding dimensions.
Fully local setup using Ollama for both text generation and embeddings.Prerequisites: Install Ollama and pull the required models:
ollama pull llama3.1:8b
ollama pull nomic-embed-text:latest
.env configuration:
# LLM — Ollama
LLM_PROVIDER="ollama"
LLM_MODEL="llama3.1:8b"
LLM_ENDPOINT="http://localhost:11434/v1"
LLM_API_KEY="ollama"

# Embeddings — Ollama
EMBEDDING_PROVIDER="ollama"
EMBEDDING_MODEL="nomic-embed-text:latest"
EMBEDDING_ENDPOINT="http://localhost:11434/api/embed"
EMBEDDING_DIMENSIONS="768"
HUGGINGFACE_TOKENIZER="nomic-ai/nomic-embed-text-v1.5"
LLM_API_KEY="ollama" is a placeholder required by the client library — Ollama itself does not validate it. HUGGINGFACE_TOKENIZER is the HuggingFace repo ID of the tokenizer used for token counting when sending requests to the Ollama embedding endpoint.

LLM Providers

Configure OpenAI, Azure, Gemini, Anthropic, Ollama, or custom LLM providers

Embedding Providers

Set up OpenAI, Mistral, Ollama, Fastembed, or custom embedding services

Setup Configuration

Full configuration reference for all backends