Skip to content
Subs -30% SUB30
> docs/environment-variables

Environment Variables Reference

3 min read Configuration Last updated March 05, 2026

Overview

Environment variables control how your OpenClaw instance connects to services and configures its runtime behavior. Most variables are set automatically by ClawHosters based on your dashboard settings. Some can be customized via SSH for advanced use cases.

Advanced Config Editor

Variables Set by ClawHosters

These variables are managed automatically. Changing your dashboard settings updates them on the next config deployment.

Instance Identification

Variable Description Example
OPENCLAW_INSTANCE_ID Unique instance identifier 42
OPENCLAW_CUSTOMER_ID Your customer ID 7
OPENCLAW_TIER Your tier name budget, balanced, pro
OPENCLAW_INSTANCE_NAME The name you gave your instance my-assistant
OPENCLAW_GATEWAY_MODE Gateway operating mode local
OPENCLAW_GATEWAY_TOKEN SHA256-hashed token for web UI auth a1b2c3...
OPENCLAW_API_ENDPOINT API endpoint for instance communication https://api.clawhosters.com

LLM Configuration

Variable Description Set When
LLM_MODE LLM operating mode Always
ANTHROPIC_API_KEY Anthropic API key Anthropic selected
OPENAI_API_KEY OpenAI API key OpenAI selected
OPENROUTER_API_KEY OpenRouter API key OpenRouter selected
GEMINI_API_KEY Google Gemini API key Google selected
DEEPSEEK_API_KEY DeepSeek API key DeepSeek selected
MISTRAL_API_KEY Mistral API key Mistral selected
GROQ_API_KEY Groq API key Groq selected

LLM_MODE values:

Value Meaning
none No LLM configured. Gateway-only mode
byok Bring Your Own Key. Your API key, direct to provider
managed Managed LLM. Routed through ClawHosters infrastructure

When LLM_MODE is managed, routing is configured automatically.

Playwright (Browser)

Variable Description Value
PLAYWRIGHT_BROWSERS_PATH Where Chromium is installed /opt/playwright-browsers

This is set in all instances. Chromium is pre-installed in the base snapshot for web automation skills.

Docker Compose Variables

Some variables are set in the docker-compose.yml file and affect the container runtime. These include Node.js memory optimization settings that are configured automatically based on your tier to ensure stable performance.

Viewing Current Variables

Via Dashboard

Your instance's current environment variables are visible in the instance detail page. Sensitive values (API keys, tokens) are masked.

Via SSH

To see all variables inside the running container:

bash
docker exec openclaw-<id> env

To check a specific variable:

bash
docker exec openclaw-<id> printenv LLM_MODE

Adding Custom Variables

If you need to set custom environment variables (for MCP servers or custom skills):

Temporary (Until Container Restart)

bash
docker exec openclaw-<id> bash -c "export MY_VAR=value && ..."

This does not persist across restarts.

Persistent (Via .env File)

SSH into your instance and edit the .env file:

bash
# On the host (not inside the container)
nano /opt/openclaw/.env

Add your variable:

text
MY_CUSTOM_VAR=some-value

Then restart the container:

bash
cd /opt/openclaw && docker compose restart

Custom variables in .env persist across restarts but are overwritten during a full redeploy from the dashboard. To keep custom variables after redeploy, add them again after each deployment.

Security Notes

  • API keys are stored encrypted in the ClawHosters database
  • Keys are decrypted only during config deployment
  • On the instance, keys exist as plaintext in openclaw.json and environment variables
  • The instance's firewall restricts network access, limiting exposure
  • Never share your instance's .env file or openclaw.json. They contain secrets.

Related Documentation