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:
.env configuration:
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. It is optional β€” Cognee no longer requires it at startup β€” but recommended for accurate token counting.Runnable version: examples/demos/local_ollama_example.py sets this same configuration in Python, pins the embedded local stack (Ladybug graph, LanceDB vectors, SQLite metadata) into a temporary directory, and runs add β†’ cognify β†’ search over a short sample text.
If your log shows a warning about the model name early in the run, that is Cognee’s advisory Ollama model-support check, not a failure β€” extraction continues regardless. See Model Support Warning on the LLM Providers page for the recommended, problematic, and unvalidated model lists.
If you are running the Cognee backend locally or self-hosted, you can verify it with:
A 200 OK confirms the backend is up. This is the local/self-hosted check only; it does not contact Cognee Cloud.

Troubleshooting

Cognee is free and open source β€” running it locally with Ollama needs no account, subscription, or paid API key. You are not being asked to pay for anything.The error appears because Ollama is one of the providers Cognee requires a non-empty LLM_API_KEY for, even though Ollama itself ignores the value. If LLM_API_KEY is unset or empty, Cognee raises LLMAPIKeyNotSetError before it ever contacts your local server.The fix is to set any placeholder string β€” the convention is ollama:
For the local examples above, keep LLM_API_KEY="ollama" in place. Fastembed does not need an embedding API key, and Ollama embeddings use the same local placeholder. Use the complete .env blocks in the tabs above so neither provider falls back to OpenAI.If you hit this error while running the local UI (cognee.start_ui() or cognee-cli -ui), you can also paste an API key directly into the dashboard instead of restarting with a .env change β€” the dashboard shows a warning banner and a modal that applies the key to the running backend. See Add an LLM API key from the dashboard.
If Cognee can’t reach Ollama, work through these checks:
  1. Ollama is running. Start the server with ollama serve, or open the Ollama desktop app. Verify with:
  2. Endpoints match Ollama’s API surface. The LLM endpoint must use the OpenAI-compatible path and the embedding endpoint uses the native Ollama path:
  3. The required models are pulled. Cognee does not pull models on demand:
  4. Running Cognee in Docker? localhost inside the container does not point at Ollama on the host. Use host.docker.internal instead:
  5. Repeated timeouts under load. Ollama processes requests sequentially. If the default EMBEDDING_BATCH_SIZE of 36 overwhelms it, lower the batch size:
For more detail on embedding-side tuning, see Embedding Providers β†’ Ollama.

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