Configuration
Learn how to configure OpenClaw to match your workflow and preferences.
Configuration File
OpenClaw uses a YAML configuration file located at ~/.openclaw/config.yaml. This file controls all aspects of your AI assistant's behavior.
Basic Structure
# ~/.openclaw/config.yaml
# AI Model Configuration
model:
provider: anthropic
model: claude-sonnet-4-20250514
apiKey: sk-ant-your-api-key
# Gateway Settings
gateway:
port: 3000
host: localhost
# Channel Configuration
channels:
telegram:
enabled: true
token: your-bot-token
Model Configuration
OpenClaw supports multiple AI providers. Configure your preferred model in the model section:
Anthropic (Claude)
model:
provider: anthropic
model: claude-sonnet-4-20250514
apiKey: sk-ant-api03-xxxxx
OpenAI (GPT-4)
model:
provider: openai
model: gpt-4-turbo
apiKey: sk-xxxxx
Google (Gemini)
model:
provider: google
model: gemini-pro
apiKey: your-google-api-key
Gateway Configuration
The gateway is the core service that handles all communication:
gateway:
port: 3000 # Port to listen on
host: 0.0.0.0 # Host to bind to
cors: true # Enable CORS
rateLimit:
enabled: true
maxRequests: 100
windowMs: 60000
Channel Configuration
Connect OpenClaw to various messaging platforms:
Telegram
channels:
telegram:
enabled: true
token: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
allowedUsers:
- 123456789
Discord
channels:
discord:
enabled: true
token: "your-discord-bot-token"
allowedGuilds:
- "guild-id-here"
Environment Variables
You can also use environment variables for sensitive values:
model:
provider: anthropic
model: claude-sonnet-4-20250514
apiKey: ${ANTHROPIC_API_KEY}
Then set the environment variable:
export ANTHROPIC_API_KEY=sk-ant-api03-xxxxx
Advanced Options
Heartbeat Configuration
heartbeat:
enabled: true
intervalMs: 300000 # 5 minutes
prompt: "Check for updates"
Memory Settings
memory:
enabled: true
maxTokens: 8000
summarizeThreshold: 6000
Tool Permissions
tools:
exec:
enabled: true
allowlist:
- "git"
- "npm"
- "node"
browser:
enabled: true
files:
enabled: true
workspace: "~/.openclaw/workspace"
💡 Pro Tip
After modifying the configuration, restart the gateway with openclaw gateway restart for changes to take effect.