Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment variables

Any config field can be set via an environment variable. The variables are applied after the config file loads and before the server validates.

LLM

VariableMaps toNotes
LLM_MEM_LLM_API_KEYllm.api_key
LLM_MEM_LLM_API_BASE_URLllm.api_url
LLM_MEM_LLM_MODELllm.model
LLM_MEM_MODELS_DIRllm.models_dir
LLM_MEM_GPU_LAYERSllm.gpu_layersu32
LLM_MEM_CONTEXT_SIZEllm.context_sizeu32
LLM_MEM_TEMPERATUREllm.temperaturef32
LLM_MEM_MAX_TOKENSllm.max_tokensu32
LLM_MEM_CPU_THREADSllm.cpu_threadsi32
LLM_MEM_MAX_CONCURRENT_REQUESTSllm.max_concurrent_requestsusize

Embedding

VariableMaps toNotes
LLM_MEM_EMBEDDING_API_KEYembedding.api_key
LLM_MEM_EMBEDDING_API_BASE_URLembedding.api_url
LLM_MEM_EMBEDDING_MODELembedding.model

Fallback

VariableMaps toNotes
OPENAI_API_KEYllm.api_key and embedding.api_keyOnly fills if both are still empty after the specific env vars are applied. Standard OpenAI convention.

Network

VariableMaps toNotes
HTTPS_PROXYoutbound HTTPS proxyUsed for model downloads. Format: http://host:port or http://user:pass@host:port
HTTP_PROXYoutbound HTTP proxy
ALL_PROXY / all_proxySOCKS proxy

The llm.proxy_url config (or --proxy CLI flag) overrides the env-var proxy.

Logging

VariableNotes
RUST_LOGtracing-subscriber filter syntax. Overrides the logging.level config.
APPIMAGE_EXTRACT_AND_RUNAppImage-only. Run without FUSE by extracting to a tmpfs.

Abstraction pipeline

Unlike the tables above, these variables are not config-field overrides — they are read directly at startup. Invalid values are logged and fall back to the default.

VariableDefaultNotes
LLM_MEM_ABSTRACTION_DELAY_SECS30Delay between abstraction pipeline cycles.
LLM_MEM_ABSTRACTION_CONCURRENCY3Concurrent abstraction tasks per cycle (max_concurrent_tasks). Raise for batch/benchmark workloads.
LLM_MEM_BACKGROUND_LLM_CONCURRENCY3Background LLM permits available to the abstraction pipeline. Raise alongside LLM_MEM_ABSTRACTION_CONCURRENCY so concurrency isn’t throttled by the interactive-friendly default.

Usage in MCP config

Set environment variables in the MCP config’s env block:

{
  "mcp": {
    "llm-mem": {
      "type": "local",
      "command": ["/path/to/llm-mem-mcp"],
      "env": {
        "LLM_MEM_LLM_API_KEY": "sk-...",
        "LLM_MEM_MODELS_DIR": "/home/you/.cache/llm-mem/models",
        "RUST_LOG": "info,llm_mem::search=debug",
        "HTTPS_PROXY": "http://proxy.corp:8080"
      }
    }
  }
}

Tip

For per-machine settings (proxy, models dir, API key), prefer the env block in the MCP config. For per-deployment settings (URL, model), prefer the TOML config file. Don’t put secrets in the TOML if the file is committed.

Override order

When the same field is set in multiple places, the priority is:

  1. CLI flag (highest)
  2. Specific env var (e.g. LLM_MEM_LLM_API_KEY)
  3. Generic env var (e.g. OPENAI_API_KEY)
  4. Config file value
  5. Default (lowest)

So --api-url on the CLI beats LLM_MEM_LLM_API_BASE_URL which beats [llm].api_url in config.toml which beats the hardcoded default.

Next