Skip to content

The .env file

npm start reads a file called .env in the repository root. The repository ships .env.example, which you copy:

Terminal window
cp .env.example .env

.env is gitignored. Never commit it, since it holds your API keys.

  • Lines are KEY=value. Lines starting with # are comments.
  • Anything already set in your shell wins over the file.
  • npm start passes the file to Node with --env-file-if-exists=.env, so a missing file is not an error.
  • Values with spaces or JSON go on one line, for example KNETIK_MODULE_CONFIG={"content-creator":{"brandVoice":"Plain, warm and specific."}}.
.env.example (abridged)
KNETIK_MODE=local
OPENROUTER_API_KEY=
KNETIK_DEFAULT_MODEL=openrouter/anthropic/claude-sonnet-5.5
KNETIK_AI_SEARCH=openrouter
KNETIK_AI_MAX_IMAGES_PER_RUN=4
Setting Why
KNETIK_MODE=local One person, this machine. See Local mode.
OPENROUTER_API_KEY Required. Your key for model calls through OpenRouter.
KNETIK_DEFAULT_MODEL The model agents use, as openrouter/<OpenRouter model id>.
KNETIK_AI_SEARCH Web search. openrouter needs no extra account; web results are billed on top of the model call.
KNETIK_AI_MAX_IMAGES_PER_RUN A cap on images per run while you experiment. Default 8.

Optional lines, commented out by default, set a cheaper model for single calls in code stages (KNETIK_AI_CHAT_MODEL), an image model (KNETIK_AI_IMAGE), the search model (KNETIK_AI_SEARCH_MODEL), Brave Search instead (KNETIK_AI_SEARCH=brave with BRAVE_API_KEY), per-module settings (KNETIK_MODULE_CONFIG) and the port (PORT).

Each of these is explained in AI and model configuration and the full environment variable reference.

Run npm run check:env after editing, so a typo fails there and not in the middle of a run.