Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
OpenClaw pulls environment variables from multiple sources. The rule is never override existing values.
.env.env~/.openclaw/.env$OPENCLAW_STATE_DIR/.envenv~/.openclaw/openclaw.jsonenv.shellEnv.enabledOPENCLAW_LOAD_SHELL_ENV=1On Ubuntu fresh installs that use the default state dir, OpenClaw also treats
~/.config/openclaw/gateway.env.env~/.openclaw/.envIf the config file is missing entirely, step 4 is skipped; shell import still runs if enabled.
envTwo equivalent ways to set inline env vars (both are non-overriding):
json5{ env: { OPENROUTER_API_KEY: "sk-or-...", vars: { GROQ_API_KEY: "gsk-...", }, }, }
env.shellEnvjson5{ env: { shellEnv: { enabled: true, timeoutMs: 15000, }, }, }
Env var equivalents:
OPENCLAW_LOAD_SHELL_ENV=1OPENCLAW_SHELL_ENV_TIMEOUT_MS=15000OpenClaw also injects context markers into spawned child processes:
OPENCLAW_SHELL=execexecOPENCLAW_SHELL=acpacpxOPENCLAW_SHELL=acp-clientopenclaw acp clientOPENCLAW_SHELL=tui-local!These are runtime markers (not required user config). They can be used in shell/profile logic to apply context-specific rules.
OPENCLAW_THEME=lightOPENCLAW_THEME=darkCOLORFGBGYou can reference env vars directly in config string values using
${VAR_NAME}json5{ models: { providers: { "vercel-gateway": { apiKey: "${VERCEL_GATEWAY_API_KEY}", }, }, }, }
See Configuration: Env var substitution for full details.
${ENV}OpenClaw supports two env-driven patterns:
${VAR}{ source: "env", provider: "default", id: "VAR" }Both resolve from process env at activation time. SecretRef details are documented in Secrets Management.
| Variable | Purpose |
|---|---|
text OPENCLAW_HOME | Override the home directory used for all internal path resolution ( text ~/.openclaw/ |
text OPENCLAW_STATE_DIR | Override the state directory (default text ~/.openclaw |
text OPENCLAW_CONFIG_PATH | Override the config file path (default text ~/.openclaw/openclaw.json |
| Variable | Purpose |
|---|---|
text OPENCLAW_LOG_LEVEL | Override log level for both file and console (e.g. text debugtext tracetext logging.leveltext logging.consoleLevel |
OPENCLAW_HOMEWhen set,
OPENCLAW_HOME$HOMEos.homedir()Precedence:
OPENCLAW_HOME$HOMEUSERPROFILEos.homedir()Example (macOS LaunchDaemon):
xml<key>EnvironmentVariables</key> <dict> <key>OPENCLAW_HOME</key> <string>/Users/user</string> </dict>
OPENCLAW_HOME~/svc$HOMEIf Node.js was installed via nvm (not the system package manager), the built-in
fetch()web_fetch"fetch failed"On Linux, OpenClaw automatically detects nvm and applies the fix in the actual startup environment:
openclaw gateway installNODE_EXTRA_CA_CERTSopenclawNODE_EXTRA_CA_CERTSManual fix (for older versions or direct node ...
Export the variable before starting OpenClaw:
bashexport NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt openclaw gateway run
Do not rely on writing only to
~/.openclaw/.envNODE_EXTRA_CA_CERTSOpenClaw only reads
OPENCLAW_*CLAWDBOT_*MOLTBOT_*If any are still set on the Gateway process at startup, OpenClaw emits a single Node deprecation warning (
OPENCLAW_LEGACY_ENV_VARSOPENCLAW_CLAWDBOT_GATEWAY_TOKENOPENCLAW_GATEWAY_TOKEN© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine