# Khoj

Personal AI assistant that answers from the web and your own documents.

- Replaces: [ChatGPT](https://openlogs.fyi/alternatives/chatgpt)
- Summary: Paid AI assistant services, such as ChatGPT.
- Stack: Python (language)
- Deployment: docker_compose
- License: AGPL-3.0 (osi) [source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/LICENSE)
- Business model: unknown. The README at the pinned commit does not state a business model, so it stays unknown. ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/README.md), read 2026-10-22)
- Difficulty: medium. 5 services (1 database or broker: pgvector), 6 volume mounts, no env values to set, no elevated host access. Heuristic score 5 of 11: medium.
- Requirements: not stated
- Repository: [khoj-ai/khoj](https://github.com/khoj-ai/khoj)

## Install

1. Docker with the Compose plugin ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml))

   ```text
   A host with Docker and the Docker Compose plugin. This entry runs from a compose file.
   ```

2. Save the compose file as docker-compose.yml ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml))

   ```yaml
   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
         #
         # Uncomment appropriate lines below to use chat models by OpenAI, Anthropic, Google.
         # Ensure you set your provider specific API keys.
         # ---
         # - OPENAI_API_KEY=your_openai_api_key
         # - GEMINI_API_KEY=your_gemini_api_key
         # - ANTHROPIC_API_KEY=your_anthropic_api_key
         #
         # Uncomment line below to enable Khoj to use its computer.
         # - KHOJ_OPERATOR_ENABLED=True
         # Uncomment appropriate lines below to enable web results with Khoj
         # Ensure you set your provider specific API keys.
         # ---
         # Paid, Fast API. Only does web search. Get API key from https://serper.dev/
         # - SERPER_DEV_API_KEY=your_serper_dev_api_key
         # Paid, Higher Read Success API. Only does webpage read. Get API key from https://olostep.com/
         # - OLOSTEP_API_KEY=your_olostep_api_key
         # Paid, Open API. Does both web search and webpage read. Get API key from https://firecrawl.dev/
         # - FIRECRAWL_API_KEY=your_firecrawl_api_key
         # Paid, Fast API. Does both web search and webpage read. Get API key from https://exa.ai/
         # - EXA_API_KEY=your_exa_api_key
         #
         # Uncomment the necessary lines below to make your instance publicly accessible.
         # Proceed with caution, especially if you are using anonymous mode.
         # ---
         # - KHOJ_NO_HTTPS=True
         # Replace the KHOJ_DOMAIN with the server's externally accessible domain or I.P address from a remote machie (no http/https prefix).
         # Ensure this is set correctly to avoid CSRF trusted origin or unset cookie issue when trying to access the admin panel.
         # - KHOJ_DOMAIN=192.168.0.104
         # - KHOJ_DOMAIN=khoj.example.com
         # Replace the KHOJ_ALLOWED_DOMAIN with the server's internally accessible domain or I.P address on the host machine (no http/https prefix).
         # Only set if using a load balancer/reverse_proxy in front of your Khoj server. If unset, it defaults to KHOJ_DOMAIN.
         # For example, if the load balancer service is added to the khoj docker network, set KHOJ_ALLOWED_DOMAIN to khoj's docker service name: `server'.
         # - KHOJ_ALLOWED_DOMAIN=server
         # - KHOJ_ALLOWED_DOMAIN=127.0.0.1
         # Uncomment the line below to disable telemetry.
         # Telemetry helps us prioritize feature development and understand how people are using Khoj
         # Read more at https://docs.khoj.dev/miscellaneous/telemetry
         # - KHOJ_TELEMETRY_DISABLE=True
       # Comment out this line when you're using the official ghcr.io/khoj-ai/khoj-cloud:latest prod image.
       command: --host="0.0.0.0" --port=42110 -vv --anonymous-mode --non-interactive
   
   volumes:
     khoj_config:
     khoj_db:
     khoj_models:
     khoj_search:
     khoj_computer:
   ```

3. Set the values the compose file needs ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml))

   ```text
   Replace the placeholder values listed under Gotchas.
   ```

4. Start it ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml))

   ```bash
   docker compose up -d
   ```

5. Open the app ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml))

   ```text
   Open http://localhost:42110. The compose file publishes host port 42110 for the server service.
   ```

Compose file check: config_ok on 2026-10-22.

## Gotchas and maintenance

### Gotchas

- Some images use the latest tag or no tag: Images without a pinned version: sandbox: ghcr.io/khoj-ai/terrarium:latest, search: docker.io/searxng/searxng:latest, computer: ghcr.io/khoj-ai/khoj-computer:latest, server: ghcr.io/khoj-ai/khoj:latest. A later pull can get a different version. ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml), checked 2026-10-22)
- The compose file has placeholder values: Placeholder values: KHOJ_DJANGO_SECRET_KEY is "secret" (server), KHOJ_ADMIN_PASSWORD is "password" (server). ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml), checked 2026-10-22)
- The compose file publishes host ports: Host ports: 5900 (computer), 42110 (server). A port without a host address listens on all host network interfaces. ([source](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml), checked 2026-10-22)

### Signals

Computed from a GitHub snapshot taken 2026-10-22.

- Open issues and pull requests: 167
- Stars: 37784, forks: 2524
- Last push: 2026-08-02 (80 days ago)
- Latest release: 2.0.0-beta.28 on 2026-03-26 (209 days ago)

## Sources

- [Repository: https://github.com/khoj-ai/khoj](https://github.com/khoj-ai/khoj)
- [License: https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/LICENSE](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/LICENSE)
- [Business model: https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/README.md](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/README.md)
- [Compose file: https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml](https://github.com/khoj-ai/khoj/blob/ae229ca894c0b80ad84664afcfdde523b5e87057/docker-compose.yml)

---
Canonical: https://openlogs.fyi/tools/khoj  
Last updated: 2026-10-22
