Guides

OpenClaw Configuration: Complete Guide to Every Setting (2026)

Master OpenClaw configuration with this comprehensive guide. Environment variables, config.json structure, AI providers, messaging platforms, and advanced settings explained.

OpenClaw Configuration: Complete Guide to Every Setting (2026)

Proper configuration is what separates a working OpenClaw agent from hours of troubleshooting. This guide covers every configuration option — from the essentials you need on day one to advanced settings for power users.

Prefer zero configuration? NeatClaw sets everything up for you via a web dashboard — no .env files, no JSON editing, no terminal commands.


Configuration File Locations

OpenClaw uses two main files:

File Purpose
.env Secrets and environment variables (API keys, ports)
config.json Structured settings (AI providers, channels, behavior)

Default directory:

  • Linux/macOS: ~/.openclaw/
  • Windows WSL2: /home/<username>/.openclaw/
  • Custom path: Set OPENCLAW_CONFIG_DIR environment variable

Environment Variables (.env)

Create ~/.openclaw/.env with these variables:

Required Variables

# AI Provider (at least one required)
ANTHROPIC_API_KEY=sk-ant-your-key-here

# Gateway
GATEWAY_PORT=18789
GATEWAY_HOST=0.0.0.0

Optional Variables

# Memory & Storage
MEMORY_DIR=./memory
MEMORY_MAX_SIZE=1GB
MEMORY_PERSISTENCE=true

# Logging
LOG_LEVEL=info          # debug | info | warn | error
LOG_FILE=./logs/openclaw.log

# Performance
MAX_CONCURRENT_REQUESTS=5
TIMEOUT_SECONDS=30

# Security
API_KEY_ENCRYPTION=true
ALLOWED_IPS=127.0.0.1,192.168.1.0/24

Messaging Platform Tokens

# Telegram
TELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...
TELEGRAM_ALLOWED_USERS=123456,789012

# Discord
DISCORD_BOT_TOKEN=your-discord-token
DISCORD_APPLICATION_ID=your-app-id

# WhatsApp Business API
WHATSAPP_PHONE_NUMBER_ID=your-number-id
WHATSAPP_ACCESS_TOKEN=your-access-token
WHATSAPP_VERIFY_TOKEN=your-verify-token

config.json Structure

The config.json file controls OpenClaw's features and behavior:

{
  "version": "1.0",
  "agent": {
    "name": "MyAgent",
    "description": "Personal AI assistant",
    "model": {
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20241022",
      "temperature": 0.7,
      "maxTokens": 4096
    }
  },
  "channels": {
    "telegram": { "enabled": true },
    "discord": { "enabled": false },
    "web": { "enabled": true, "port": 3000 }
  },
  "memory": {
    "type": "file",
    "maxEntries": 1000,
    "autoSave": true,
    "saveInterval": 60
  },
  "features": {
    "shellAccess": true,
    "fileOperations": true,
    "browserAutomation": false,
    "apiAccess": true
  }
}

AI Provider Configuration

Anthropic (Claude) — Recommended

{
  "model": {
    "provider": "anthropic",
    "model": "claude-3-5-sonnet-20241022",
    "temperature": 0.7,
    "maxTokens": 4096,
    "systemPrompt": "You are a helpful AI assistant..."
  }
}

Available models:

Model Speed Cost Best For
claude-3-5-sonnet-20241022 Fast Medium General use (recommended)
claude-3-opus-20240229 Slow High Complex reasoning
claude-3-haiku-20240307 Fastest Low High-volume, simple tasks

OpenAI (GPT)

{
  "model": {
    "provider": "openai",
    "model": "gpt-4-turbo-preview",
    "temperature": 0.8,
    "maxTokens": 4096
  }
}

DeepSeek

{
  "model": {
    "provider": "deepseek",
    "model": "deepseek-chat",
    "temperature": 0.7
  }
}

Messaging Platform Setup

Telegram

{
  "channels": {
    "telegram": {
      "enabled": true,
      "features": ["text", "images", "files", "voice"],
      "allowedUsers": [123456, 789012],
      "commands": {
        "/start": "greeting",
        "/help": "show_help",
        "/reset": "clear_memory"
      },
      "autoReply": true,
      "typingIndicator": true
    }
  }
}

Getting your Telegram bot token: Message @BotFather, send /newbot, follow the prompts, and copy the token (format: 123456789:ABCdefGHI...).

Discord

{
  "channels": {
    "discord": {
      "enabled": true,
      "features": ["text", "embeds", "reactions"],
      "allowedGuilds": ["server-id-1"],
      "allowedChannels": ["channel-id-1"],
      "slashCommands": true,
      "prefix": "!"
    }
  }
}

WhatsApp Business

{
  "channels": {
    "whatsapp": {
      "enabled": true,
      "businessAccountId": "your-business-id",
      "features": ["text", "media", "templates"],
      "autoReply": true
    }
  }
}

Memory & Persistence

File-Based Memory (Default)

{
  "memory": {
    "type": "file",
    "directory": "./memory",
    "maxEntries": 1000,
    "autoSave": true,
    "saveInterval": 60,
    "compression": true
  }
}

Database Memory (Advanced)

{
  "memory": {
    "type": "database",
    "driver": "postgresql",
    "connection": {
      "host": "localhost",
      "port": 5432,
      "database": "openclaw",
      "user": "openclaw_user",
      "password": "secure_password"
    }
  }
}

Advanced Configuration

Performance Tuning

{
  "performance": {
    "maxConcurrentRequests": 10,
    "timeoutSeconds": 30,
    "retryAttempts": 3,
    "cacheEnabled": true,
    "cacheTTL": 3600
  }
}

Security Settings

{
  "security": {
    "apiKeyEncryption": true,
    "allowedIPs": ["127.0.0.1", "192.168.1.0/24"],
    "rateLimiting": {
      "enabled": true,
      "maxRequestsPerMinute": 60
    }
  }
}

Logging

{
  "logging": {
    "level": "info",
    "file": "./logs/openclaw.log",
    "maxFileSize": "10MB",
    "maxFiles": 5,
    "format": "json"
  }
}

Common Configuration Errors

Invalid API Key (Status 401)

  1. Verify key format: sk-ant- for Anthropic, sk- for OpenAI
  2. Check for extra spaces or newlines in .env
  3. Restart OpenClaw after changing .env

Port Already in Use

lsof -i :18789    # Find blocking process
kill -9 <PID>     # Kill it
# Or set GATEWAY_PORT=18790 in .env

Memory Persistence Failed

chmod 755 ~/.openclaw/memory
chown $USER ~/.openclaw/memory

Configuration Best Practices

  1. Never commit .env to git — add it to .gitignore immediately
  2. Use environment-specific configsconfig.dev.json, config.prod.json
  3. Rotate API keys regularly — security best practice
  4. Back up your config — before making any changes
  5. Test after every change — verify behavior before deploying

The Zero-Configuration Alternative

Every setting on this page exists because self-hosted OpenClaw requires manual configuration. NeatClaw replaces all of it with a web dashboard:

Self-Hosted NeatClaw
Edit .env files Web form with validation
Edit config.json Visual toggles and dropdowns
Manage API keys in files Encrypted secrets vault
Configure messaging platforms OAuth one-click connect
Handle permission errors Not possible (managed)

Get started with NeatClaw — zero configuration


Sources: OpenClaw Official Documentation, Telegram Bot API, Discord Developer Portal

Skip the setup. Start using OpenClaw now.

Your managed agent live in 2 minutes. No terminal, no Docker, no debugging.

Get started free