Skip to content

Environment variables

Settings are environment variables. In local mode, npm start also reads .env (see The .env file); anything set in your shell wins. Hosted deployments pass them through the container environment. Never put secrets in the repository.

Variable Default Meaning
KNETIK_MODE local runs for one person on this machine with no sign-in, a SQLite file and files in .knetik/local/. See Local mode.
PORT 3000 The port to listen on
KNETIK_WORKSPACE_NAME the base URL’s host The workspace name the dashboard shows
KNETIK_DATA_DIR ./.knetik/data (local mode: ./.knetik/local) The one folder for everything the Node host stores: knetik.db, flue.db and artifacts/. Hosted, point it at a persistent volume.
KNETIK_LOCAL_ALLOW_REMOTE 1 lets a no-sign-in server answer other machines. Dangerous.
Variable Required Meaning
KNETIK_ARTIFACTS_DIR Where artifact files go. Default <data dir>/artifacts. 25 MB per file.
KNETIK_FLUE_DB Path of the agent framework’s own store. Default <data dir>/flue.db.

These apply to the Node host. The Cloudflare host does not read them: it uses the D1 binding DB and the R2 binding ARTIFACTS from its Wrangler configuration. See the hosting overview.

The server refuses to start unless it has a base URL, an allowlist and at least one sign-in method. See Sign-in.

Variable Meaning
KNETIK_BASE_URL Public origin with no path. Used for sign-in callbacks, magic links and the cross-origin check.
KNETIK_ALLOWED_USERS Who may sign in: user@x.com, *@x.com, github:login, comma separated
KNETIK_ADMINS Same syntax. These people are always admins and can always sign in; they are changed only here, never in the dashboard. At least one of the two lists must be non-empty. More people, roles and disabling are managed on the Users page.
KNETIK_MAIL smtp or console (prints links to the server log: trials only). Enables magic-link sign-in.
SMTP_URL, KNETIK_MAIL_FROM Needed for smtp; the sender is optional
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET Enables GitHub sign-in
FIREBASE_PROJECT_ID, FIREBASE_WEB_CONFIG Enables Google sign-in through Firebase
KNETIK_TRUST_PROXY 1 to read the client IP from X-Forwarded-For. Only behind a proxy you control.
KNETIK_SESSION_DAYS Session lifetime, default 30 (the idle limit is 7 days)

Details in AI and model configuration.

Variable Meaning
KNETIK_DEFAULT_MODEL The model agents use, provider/model-id
KNETIK_AI_CHAT_MODEL Model for ctx.ai.chat. Defaults to KNETIK_DEFAULT_MODEL.
KNETIK_AI_IMAGE openrouter:<model>
KNETIK_AI_SEARCH openrouter or brave
KNETIK_AI_SEARCH_MODEL OpenRouter model that runs searches
KNETIK_AI_MODULES JSON of per-module chat and image overrides
KNETIK_AI_MAX_IMAGES_PER_RUN Default 8
KNETIK_AI_TIMEOUT_MS Default 120000
OPENROUTER_API_KEY OpenRouter key
BRAVE_API_KEY Brave Search key
Provider key such as ANTHROPIC_API_KEY For a model you name directly
Variable Meaning
KNETIK_MODULE_CONFIG Per-module settings as JSON: {"<module id>":{"<setting>":value}}. Values saved from the dashboard override these per key.
KNETIK_APPROVER CLI: who knetik add records as approver. Defaults to your OS user name.

See Connectors.

Variable Meaning
KNETIK_SECRET_KEY Encrypts connector tokens. Generate with knetik keygen. Without it, connectors are off.
KNETIK_SECRET_KEY_ID Names the key, default k1
KNETIK_SECRET_KEYS_PREVIOUS Old keys after a rotation, as id:base64,id:base64
SLACK_CLIENT_ID, SLACK_CLIENT_SECRET Slack app credentials. Redirect URL ${KNETIK_BASE_URL}/connectors/slack/callback. Optional: an admin can enter them in the dashboard instead; the environment wins if both exist.
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET Google OAuth client. Redirect URI ${KNETIK_BASE_URL}/connectors/google/callback. Optional: an admin can enter them in the dashboard instead; the environment wins if both exist.
KNETIK_MCP_CLIENTS JSON of pre-registered OAuth clients by MCP server origin
KNETIK_MCP_CIMD 1 to use a hosted client metadata document (needs an https base URL)

These exist for knetik dev and the test suites. Do not set them in production.

Variable Meaning
KNETIK_DEV 1 turns the login off and uses dev wiring. Set by knetik dev.
KNETIK_STUB_MODEL 1 forces the scripted model, search, pages and images
KNETIK_MODEL_SCRIPT The script file used by the stub model
KNETIK_ALLOW_PRIVATE_FETCH 1 lets page fetching reach private addresses. Tests and local development only.
KNETIK_ALLOW_INSECURE_MCP 1 allows http and private-network MCP servers. Tests and local development only.
KNETIK_WEB_DIR Serve the dashboard from another folder