This AIO image keeps the first-run path simple, but the advanced template fields let you move much closer to the full upstream self-hosted runtime surface when you want to.
One upstream note is worth repeating here: after first boot or after changing core environment variables, restart the container once so Khoj reapplies the settings cleanly.
By default, khoj-aio keeps everything in one container by running an internal PostgreSQL service and storing its data under your mapped /var/lib/postgresql/data path, while app config and generated secrets live under /root/.khoj.
If you already run PostgreSQL elsewhere and want Khoj to use that instead:
- Open the Unraid template and click Show more settings...
- Set
KHOJ_USE_INTERNAL_POSTGRES=false. - Fill in the external PostgreSQL variables:
POSTGRES_HOSTPOSTGRES_PORTPOSTGRES_DBPOSTGRES_USERPOSTGRES_PASSWORD
- Re-apply the container.
If POSTGRES_HOST is set, the wrapper treats that as an external DB deployment even if you forget to toggle KHOJ_USE_INTERNAL_POSTGRES.
Khoj supports OpenAI-compatible APIs, which makes local and third-party model endpoints easy to use.
Typical knobs:
OPENAI_BASE_URLOPENAI_API_KEYKHOJ_DEFAULT_CHAT_MODELKHOJ_LLM_SEED
Set:
OPENAI_BASE_URL=http://host.docker.internal:11434/v1/
If your LLM server runs on the Unraid host rather than in another container, you may also need an Unraid extra parameter such as --add-host=host.docker.internal:host-gateway.
You can also point Khoj at:
- vLLM
- LM Studio
- LiteLLM
- LocalAI
- hosted OpenAI-compatible gateways
Khoj's admin panel is still the best place to finalize model definitions and defaults after first boot.
The upstream docker-compose.yml defaults to separate search services. This AIO image keeps those integrations optional.
Use one or more of:
KHOJ_SEARXNG_URLSERPER_DEV_API_KEYGOOGLE_SEARCH_API_KEYGOOGLE_SEARCH_ENGINE_IDFIRECRAWL_API_KEYEXA_API_KEY
Use one or more of:
OLOSTEP_API_KEYFIRECRAWL_API_KEYEXA_API_KEY
Optional API base URL overrides:
OLOSTEP_API_URLFIRECRAWL_API_URLEXA_API_URL
Optional behavior override:
KHOJ_AUTO_READ_WEBPAGE=true
If none of these are set, Khoj still works. Search and page-read quality will just depend more heavily on the basic self-hosted path.
Use one of:
KHOJ_TERRARIUM_URL=http://your-terrarium-host:8080E2B_API_KEY
Optional E2B override:
E2B_TEMPLATE
Enable only if you understand the security tradeoff:
KHOJ_OPERATOR_ENABLED=true- mount
/var/run/docker.sock
Optional expert knobs:
KHOJ_OPERATOR_ITERATIONSKHOJ_CDP_URL
If you do not configure these, normal chat/search/document workflows still work.
For LAN or internet access, the Khoj docs recommend setting:
KHOJ_DOMAINKHOJ_ALLOWED_DOMAINKHOJ_NO_HTTPS=truewhen you intentionally serve plain HTTP on a trusted LAN or behind a reverse proxy that terminates TLS
Typical examples:
KHOJ_DOMAIN=192.168.1.50KHOJ_DOMAIN=khoj.example.comKHOJ_ALLOWED_DOMAIN=serverKHOJ_ALLOWED_DOMAIN=192.168.1.50
If you use Nginx Proxy Manager, Traefik, Caddy, or Cloudflare Tunnel, these settings are the first place to look when you hit CSRF or DisallowedHost errors.
Khoj's self-hosted defaults are single-user and anonymous-mode friendly. This AIO template follows that same beginner-oriented default.
To enable sign-in:
- Set
KHOJ_ANONYMOUS_MODE=false. - Configure one of the auth paths below.
- Re-apply the container and restart once.
RESEND_API_KEYRESEND_EMAILRESEND_AUDIENCE_ID(optional)
Without Resend, Khoj can still generate magic links manually through the admin panel, but you must send them yourself.
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
Upstream currently documents Google OAuth mainly against the prod khoj-cloud image. Treat this as an expert path on the standard khoj image until you confirm your exact flow works.
ELEVEN_LABS_API_KEY
NOTION_OAUTH_CLIENT_IDNOTION_OAUTH_CLIENT_SECRETNOTION_REDIRECT_URI
AWS_ACCESS_KEYAWS_SECRET_KEYAWS_IMAGE_UPLOAD_BUCKETAWS_USER_UPLOADED_IMAGES_BUCKET_NAME
TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENTWILIO_VERIFICATION_SID
These are advanced integrations. Beginners can leave them unset.
Optional runtime tuning:
GUNICORN_WORKERSGUNICORN_TIMEOUTGUNICORN_GRACEFUL_TIMEOUTGUNICORN_KEEP_ALIVEKHOJ_RESEARCH_ITERATIONS
Telemetry:
KHOJ_TELEMETRY_DISABLE=true
Leave the runtime knobs unset unless you have a specific reason to change them. The defaults are safer than random tuning.