SH SelfHostAlt
Sponsored Self-host any open-source app on Hostinger KVM VPS from $4.99/mo (1-Click Docker) →
Khoj logo

Khoj

AGPL-3.0 Docker Ready ★ 38,270 Stars Active · 2026-08-02

Your AI second brain. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI. , Source Code.

Category
Generative Artificial Intelligence (GenAI)
Tech Stack / Runtime
Python/Docker
Open-Source License
AGPL-3.0
GitHub Health
★ 38,270 · 2,566 forks
#semantic-search#emacs#obsidian-md#chat#chatgpt
Official docker-compose.yml

Quick Docker Compose Reference for Khoj

services:
  database:
    image: docker.io/pgvector/pgvector:pg15
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    volumes:
      - khoj_db:/var/lib/postgresql/data/
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 30s
      timeout: 10s
      retries: 5
  sandbox:
    image: ghcr.io/khoj-ai/terrarium:latest
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 2
  search:
    image: docker.io/searxng/searxng:latest
    volumes:
      - khoj_search:/etc/searxng
    environment:
      - SEARXNG_BASE_URL=http://localhost:8080/
  # Creates Computer for Khoj to use.
  # Set KHOJ_OPERATOR_ENABLED=True in the server service environment variable to enable.
  computer:
    container_name: khoj-computer
    image: ghcr.io/khoj-ai/khoj-computer:latest
    # build:
    #   context: .
    #   dockerfile: computer.Dockerfile
    ports:
      - "5900:5900"
    volumes:
      - khoj_computer:/home/operator
  server:
    depends_on:
      database:
        condition: service_healthy
    # Use the following line to use the latest version of khoj. Otherwise, it will build from source. Set this to ghcr.io/khoj-ai/khoj-cloud:latest if you want to use the prod image.
    image: ghcr.io/khoj-ai/khoj:latest
    # Uncomment the following line to build from source. This will take a few minutes. Comment the next two lines out if you want to use the official image.
    # build:
      # context: .
    ports:
      # If changing the local port (left hand side), no other changes required.
      # If changing the remote port (right hand side),
      #   change the port in the args in the build section,
      #   as well as the port in the command section to match
      - "42110:42110"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    working_dir: /app
    volumes:
      - khoj_config:/root/.khoj/
      - khoj_models:/root/.cache/torch/sentence_transformers
      - khoj_models:/root/.cache/huggingface
      # uncomment line below to mount docker socket to allow khoj to use its computer.
      # - /var/run/docker.sock:/var/run/docker.sock
    # Use 0.0.0.0 to explicitly set the host ip for the service on the container. https://pythonspeed.com/articles/docker-connection-refused/
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_HOST=database
      - POSTGRES_PORT=5432
      - KHOJ_DJANGO_SECRET_KEY=secret
      - KHOJ_DEBUG=False
      - KHOJ_ADMIN_EMAIL=username@example.com
      - KHOJ_ADMIN_PASSWORD=password
      # Default URL of Terrarium, the default Python sandbox used by Khoj to run code. Its container is specified above
      - KHOJ_TERRARIUM_URL=http://sandbox:8080
      # Uncomment line below to have Khoj run code in remote E2B code sandbox instead of the self-hosted Terrarium sandbox above. Get your E2B API key from https://e2b.dev/.
      # - E2B_API_KEY=your_e2b_api_key
      # Default URL of SearxNG, the default web search engine used by Khoj. Its container is specified above
      - KHOJ_SEARXNG_URL=http://search:8080
      # Uncomment line below to use with Ollama running on your local machine at localhost:11434.
      # Change URL to use with other OpenAI API compatible providers like VLLM, LMStudio, DeepInfra, DeepSeek etc.
      # - OPENAI_BASE_URL=http://host.docker.internal:11434/v1/
      # - KHOJ_DEFAULT_CHAT_MODEL=qwen3
      #
# ... (see full file in official GitHub repository)

Khoj System Requirements & Self-Hosting Guide

Deploy Khoj (4 GB+ RAM) →

Recommended VPS

4 GB+ RAM

2 – 4 vCPU · $6 – $12/mo VPS

Deployment Method

Intermediate

Docker / Docker Compose (Recommended)

Commercial Use (AGPL-3.0)

Yes for internal team self-hosting; modified SaaS redistribution requires sharing changes.

Maintenance Status

Active

Last commit: 2026-08-02

Frequently Asked Questions about Khoj

Is Khoj free to self-host for commercial use?

Khoj is released under the AGPL-3.0 license. Yes for internal team self-hosting; modified SaaS redistribution requires sharing changes. It has 38,270 GitHub stars and was last updated on 2026-08-02.

What VPS specifications do I need to self-host Khoj?

Based on its Python/Docker runtime and Generative Artificial Intelligence (GenAI) workload, we recommend at least 4 GB+ RAM and 2 – 4 vCPU (typically $6 – $12/mo VPS).

Does Khoj support Docker deployment?

Yes — Khoj supports Docker / Docker Compose (Recommended), making it intermediate to spin up on any Linux VPS.

More Open-Source Generative Artificial Intelligence (GenAI)

View all →
★ 188k Docker

Get up and running with Llama 3.3, DeepSeek-R1, Phi-4, Gemma 3, and other large language models. .

Replaces: ChatGPT
MIT Docker/Python
Details →
★ 160k Docker

User-friendly AI Interface, supports Ollama, OpenAI API. .

BSD-3-Clause Docker/Python
Details →
★ 68.7k Docker

All-in-one desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more. .

Replaces: ChatGPT
MIT Nodejs/Docker
Details →
★ 50.6k Docker

Run your AI models locally and generate images and audio (alternative to OpenAI and Claude). , Clients).

MIT Docker/K8S
Details →
★ 47.6k Docker

Enhanced ChatGPT-compatible AI chat interface supporting multiple AI providers, with multi-user auth, message search, and plugin support. , Source Code.

Replaces: ChatGPT
MIT Nodejs/Docker
Details →
★ 38.3k Docker

AI-powered search engine (alternative to Perplexity AI).

Replaces: Plex
MIT Docker
Details →