THE PRACTICAL GUIDE

Khoj: a personal assistant for your own knowledge

Use local documents and a configurable model backend in a self-hosted assistant. Add online search only when you need it.

Core features

Khoj connects conversational assistance with personal knowledge. It supports local and hosted model backends, indexed documents and optional web research. Its upstream deployment can include a database, search engine, code sandbox and computer service; a basic document-and-chat setup does not require enabling every component.

Hardware and models

Official local setup documentation lists 8 GB RAM minimum and 5 GB available disk, with GPU acceleration recommended. Treat that as a baseline, not a promise that any model or full service stack fits. The checker uses a separate 4 GB application estimate plus model and OS reserves, and can recommend more than 8 GB overall.

You need a chat model, local embedding dependencies and model downloads. The example below uses an existing Ollama server with qwen2.5:7b. Pull it first and ensure your available memory can support it.

A five-minute Compose path

This is a reduced local chat/document configuration derived from the official Compose file. It deliberately omits web search, sandbox and computer services. Downloads and indexing take extra time. Generate secrets before starting:

umask 077
printf 'POSTGRES_PASSWORD=%s\nKHOJ_DJANGO_SECRET_KEY=%s\nKHOJ_ADMIN_PASSWORD=%s\[email protected]\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" "$(openssl rand -hex 24)" > .env

Set your actual admin email in .env; do not overwrite an existing environment file. Save this as compose.yml:

services:
  database:
    image: pgvector/pgvector:pg15
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
    volumes:
      - khoj-db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 10
  server:
    image: ghcr.io/khoj-ai/khoj:latest
    depends_on:
      database:
        condition: service_healthy
    ports:
      - "127.0.0.1:42110:42110"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      POSTGRES_DB: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
      POSTGRES_HOST: database
      POSTGRES_PORT: "5432"
      KHOJ_DJANGO_SECRET_KEY: ${KHOJ_DJANGO_SECRET_KEY:?Set KHOJ_DJANGO_SECRET_KEY in .env}
      KHOJ_ADMIN_EMAIL: ${KHOJ_ADMIN_EMAIL:?Set KHOJ_ADMIN_EMAIL in .env}
      KHOJ_ADMIN_PASSWORD: ${KHOJ_ADMIN_PASSWORD:?Set KHOJ_ADMIN_PASSWORD in .env}
      KHOJ_DEBUG: "False"
      OPENAI_BASE_URL: http://host.docker.internal:11434/v1/
      KHOJ_DEFAULT_CHAT_MODEL: qwen2.5:7b
      KHOJ_TELEMETRY_DISABLE: "True"
    volumes:
      - khoj-config:/root/.khoj
      - khoj-models:/root/.cache/torch/sentence_transformers
      - khoj-models:/root/.cache/huggingface
    command: --host=0.0.0.0 --port=42110 --non-interactive
    restart: unless-stopped
volumes:
  khoj-db:
  khoj-config:
  khoj-models:
docker compose config --quiet
docker compose up -d
docker compose logs --tail=100 server

Open http://localhost:42110. Check admin/model settings and the local chat connection. The official docs advise restarting the server after first-run configuration; use docker compose restart server. Upload a small non-sensitive test document and ask a question whose answer appears in it. Download Compose.

Reference: official Compose source pinned below, checked 2026-10-22. The latest image can change; record the digest you deploy. This reduced recipe is not a full upstream-stack runtime test.

Strengths and trade-offs

Choose it for: personal document knowledge, local inference and control of stored data. Plan around: database and model maintenance, document parsing quality, and optional features bringing their own dependencies. The reduced recipe does not provide live web search or code execution.

How it differs from Perplexity

Khoj is useful when the most important source is your material. Perplexity primarily provides a hosted research experience. Local Khoj document chat can avoid live web access after model preparation, while research over current web pages still requires internet. Local files alone do not establish that all optional integrations are offline.

THE PRACTICAL QUESTIONS

Before you deploy

Does this recipe include the complete Khoj stack?

No. It is a reduced local chat and document setup. Web search, code sandbox and computer services need separate upstream configuration.

Can Khoj be used offline?

Local chat and document workflows can work after required models are downloaded. Disable or avoid external features and verify the actual deployment before claiming complete isolation.

Why does the calculator recommend more than the official baseline?

The calculator separately budgets for the model, application services, embeddings and OS headroom. An application minimum is not a budget for every model.

Sources & verification

Official references checked 2026-10-22. Deployment snippets are documentation-reviewed and Compose-validated; containers and model inference have not been runtime-tested here.