forked from Selig/openclaw-skill
6 custom skills (assign-task, dispatch-webhook, daily-briefing, task-capture, qmd-brain, tts-voice) with technical documentation. Compatible with Claude Code, OpenClaw, Codex CLI, and OpenCode.
1.3 KiB
1.3 KiB
Environment Variables Documentation
OpenClaw manages environment variables through a hierarchical system that respects existing values without overriding them.
Loading Priority
The system follows a specific precedence order from highest to lowest priority:
- Process environment - Variables already present in the parent shell/daemon
- Local
.envfile - Located in the current working directory - Global
.envfile - Found at~/.openclaw/.env - Configuration file settings - The
envblock in~/.openclaw/openclaw.json - Shell environment import - Optional login-shell variables when enabled
Configuration Methods
You can define variables directly within the config file using two equivalent approaches:
{
env: {
OPENROUTER_API_KEY: "sk-or-...",
vars: {
GROQ_API_KEY: "gsk-...",
},
},
}
Shell environment import capability allows the system to run your login shell and import only missing expected keys.
Variable Substitution
Config files support variable references using ${VAR_NAME} syntax within string values, enabling dynamic configuration based on environment settings.
Related Resources
The documentation links to gateway configuration guides, FAQ materials about env var loading, and models overview pages for additional context.