On this page

Complete .env example

Last updated: 2026-11-22

Below is the full .env.example shipped with the download package. Every value is a placeholder. Copy it to .env and fill in your own values; never put real keys, authorization codes or administrator passwords into a repository, document or ticket.

cp .env.example .env
chmod 600 .env
# Restart after editing
wasmx stop . && wasmx start .
# ── Basics ──────────────────────────────────────────────────────────
WASMX_ADDR=127.0.0.1:3001
WASMX_DB=sqlite://data/keragi.db
# Each resource can use its own database (SQLite by default; helix://host:port is supported)
USERX_DB_URL=sqlite://data/keragi-userx.db
MSGX_DB_URL=sqlite://data/keragi-msgx.db
AGIX_DB_URL=sqlite://data/keragi-agix.db
CONN_DB_URL=sqlite://data/keragi-conn.db
# HELIX_API_KEY=...
# 每账号最多 2 台登录设备;第 3 台会挤掉最旧会话
MAX_SESSIONS_PER_USER=2
RUST_LOG=info

# At least 32 random characters; example: openssl rand -base64 48
JWT_SECRET=<GENERATE_A_RANDOM_SECRET_AT_LEAST_32_CHARS>

# ── Administrator and registration ──────────────────────────────────
# The bootstrap administrator is only created on first start with an empty DB
OPEN_REGISTRATION=false
BOOTSTRAP_ADMIN_CREDENTIAL=[email protected]
BOOTSTRAP_ADMIN_PASSWORD=<STRONG_ADMIN_PASSWORD>

USERX_ADMIN_URL=http://127.0.0.1:3001/userx
USERX_PUBLIC_URL=http://127.0.0.1:3001/userx
USERX_ADMIN_CREDENTIAL=[email protected]
USERX_ADMIN_PASSWORD=<STRONG_ADMIN_PASSWORD>

# JWKS_URL=http://127.0.0.1:3001/.well-known/jwks.json

# ── Email (captcha, notifications) ──────────────────────────────────
# All three values are required together; enterprise mail usually uses smtp.qiye.163.com
# Quote the authorization code if it contains #
# SMTP_HOST=smtp.example.com
# SMTP_PORT=465
# SMTP_TLS=implicit
# [email protected]
# SMTP_PASSWORD='<SMTP_AUTHORIZATION_CODE>'
# SMTP_FROM_NAME='Keragi notifications'

# ── msgx (messaging) ────────────────────────────────────────────────
# E2EE master switch: off by default; true enables E2EE for direct/group text
# E2EE_ENABLED=false
# MSGX_AUDIENCE=msgx
# MSGX_MSG_RETENTION_HOURS=0
# MSGX_MEDIA_ORPHAN_TTL=24
# MSGX_LAZY_CLEANUP_SECS=600
# MSGX_LAZY_CLEANUP_BATCH=200

# ── agix (text / image / video / audio) ─────────────────────────────
AGIX_DEFAULT_MODEL=deepseek-flash

# Model API keys do NOT belong in .env. Users add their own key in the client
# under Settings → AI assistant → Model key configuration; agix stores it in its
# per-user provider config. Keep only base URLs, model names and switches here.

# Text: DeepSeek
# AGIX_DEEPSEEK_URL=https://api.deepseek.com/v1

# Text / image / voice: Qianwen (Alibaba Cloud Bailian)
# AGIX_QIANWEN_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
# AGIX_DASHSCOPE_URL=https://dashscope.aliyuncs.com/api/v1

# Video: Volcano Ark Seedance
# AGIX_ARK_BASE_URL=https://ark.cn-beijing.volces.com/api/v3
# AGIX_SEEDANCE_MODEL=<SEEDANCE_MODEL_ID>

# Music: Stability Stable Audio (optional)
# AGIX_STABLE_AUDIO_URL=https://api.stability.ai/v2beta
# AGIX_STABLE_AUDIO_MODEL=stable-audio-2.5

# Polling and timeouts
# AGIX_VIDEO_POLL_INTERVAL_MS=5000
# AGIX_VIDEO_TIMEOUT_MS=300000
# AGIX_MUSIC_POLL_INTERVAL_MS=2000
# AGIX_MUSIC_TIMEOUT_MS=300000

# Metering
# AGIX_DEFAULT_DAILY_QUOTA=1000000
# AGIX_DB_CONFIG_TTL_MS=5000

# ── conn (connectors) ───────────────────────────────────────────────
# For wasm deployments the provider list comes from conn.providers in wasmx.json
# CONN_APPROVE_ORIGINS=https://app.keragi.com
# CONN_GRANT_TIMEOUT_SECS=600
# Keragi (agix): native conn-server only. Point it at the co-located agix resource.
# The caller token is forwarded from the request header; model keys are added by
# users in the client, never written into conn's env.
# Do not list providers that need a shared server-side key; production keeps agix
# (plus ssh when a local CLI is available).
# CONN_PROVIDERS=agix,ssh
# CONN_AGIX_URL=http://127.0.0.1:3001/agix
# CONN_AGIX_MODEL=deepseek-flash

# ── CORS and rate limits ────────────────────────────────────────────
# In new builds, when WASMX_CORS_ORIGINS is unset, https://app.keragi.com is allowed by default.
# An explicit list overrides the default; add self-hosted web, desktop/Android:
# WASMX_CORS_ORIGINS=https://app.keragi.com,https://keragi.example.com
# Android serves from 127.0.0.1:18731; Linux desktop origin is http://tauri.localhost
# WASMX_CORS_ALLOW_LOOPBACK=1
# USERX_RATE_LIMIT_PER_MIN=60
# MSGX_RATE_LIMIT_PER_MIN=600

# ── Lazy cleanup ────────────────────────────────────────────────────
# USERX_LAZY_CLEANUP_SECS=600
# USERX_LAZY_CLEANUP_BATCH=200
# MSGX_LAZY_CLEANUP_SECS=600
# MSGX_LAZY_CLEANUP_BATCH=200

Notes