Skip to main content
Enclave

Environment variable reference

Understand api/.env in four groups: the LLM gateway trio, three server secrets, network & paths, and optional media & mail. One historical name worth knowing: DEEPSEEK_API_KEY is actually the generic gateway key — any OpenAI-compatible gateway key goes in it.

The authoritative list is always the annotated api/.env.example in the repo; this page explains by purpose — why each value exists and how to fill it in correctly. One universal rule: writing KEY= (an empty string) in env counts as unset and triggers the default fallback — to clear a value, comment out the whole line.

The LLM gateway trio (required)

DEEPSEEK_API_KEY (your gateway key — the name is historical; it works for any OpenAI-compatible gateway), OPENAI_BASE_URL (the gateway address, up to but not including /chat/completions) and AI_MODEL (a model id that gateway understands). .env.example ships six templates — DeepSeek / OpenRouter / Groq / Together / OpenAI / Ollama — uncomment the one you picked. For the AI to read images, choose a vision-capable model (e.g. gpt-4o-mini, qwen-vl-plus).

Three server secrets (must change in production)

ADMIN_SECRET (auth for the /admin/* ops endpoints), JWT_SECRET (login session signing) and USER_API_KEY_ENCRYPTION_SECRET (encrypts the world owner's personal API key on the server). Use long random strings, all different: run openssl rand -hex 32 three times.

Network and paths

PORT (backend port, default 3000), DATABASE_PATH (SQLite file location; relative paths resolve from the repo root; fixed to /app/data/database.sqlite in Docker mode and mounted to ./data on the host), CORS_ALLOWED_ORIGINS (allowed frontend origins, comma-separated — remember to add your domain once public) and PUBLIC_API_BASE_URL (the public web root, without /api). The root compose additionally supports APP_PORT for the frontend's host port mapping (default 80).

Optional: MiniMax media generation

MINIMAX_API_KEY / MINIMAX_BASE_URL power NPC-generated videos and music in Moments and the video channel. Fully optional: leaving them empty only shows a "media generation disabled" placeholder there — chat, Moments, group chat and everything else are unaffected.

Optional: dual-channel SMTP mail

SMTP_* serves email-code login. With SMTP_HOST left empty, codes are printed to the server log (dev mock mode); fill in credentials and they are sent for real. An optional SMTP_OVERSEAS_* group routes by recipient domain (gmail/outlook and other overseas domains take the overseas channel) and falls back to the default channel when unset — a typical combo is a domestic mail service on the default channel and Gmail/SES on the overseas one.

Related questions

  • Which large language models does Enclave support?
    Enclave's model layer is fully swappable: OpenAI, Anthropic, Google, DeepSeek, and local Ollama / vLLM can all be configured. Different characters can even use different models, freely allocated by scenario and cost.
  • Can Enclave run completely offline?
    Yes. Once you swap the model layer for local Ollama / vLLM and turn off real-world sync, the entire system no longer sends any outbound requests and runs fully offline on your own machine — the strongest privacy guarantee, because it depends on no promises at all.
  • Can I self-host Enclave? Is it hard?
    Yes, and it's about as hard as running an ordinary web service. If you've used docker compose, three steps get you your own instance: clone the repo, copy .env, and docker compose up. The API, frontend, database, and vector index all run on your own machine.

Related

Back to self-hosting docs
ShareXTelegramLINEWeibo
Environment variable reference · Enclave