Skip to main content

openclaw config

Manage OpenClaw configuration values programmatically.

Usage

Run without a subcommand to launch the interactive setup wizard:

Commands

get

Get a configuration value by dot path.
string
required
Configuration path using dot notation (e.g., gateway.port)
boolean
Output in JSON format

set

Set a configuration value by dot path.
string
required
Configuration path using dot notation
string
required
Value to set (JSON5 or raw string)
boolean
Parse value as JSON5 (required for objects/arrays)

unset

Remove a configuration value by dot path.
string
required
Configuration path using dot notation

Path Notation

Configuration paths use dot notation with support for:
  • Nested objects: gateway.auth.token
  • Arrays: channels.telegram.accounts[0].token
  • Bracket notation: gateway["auth"]["token"]
  • Escaped dots: path.with\.dot.in\.key

Examples

After modifying configuration, restart the gateway for changes to take effect: openclaw gateway restart

Common Configuration Paths

Gateway

  • gateway.mode - Gateway mode (local or remote)
  • gateway.port - WebSocket port (default: 18789)
  • gateway.bind - Bind mode (loopback, lan, tailnet, auto, custom)
  • gateway.auth.mode - Auth mode (token, password, none)
  • gateway.auth.token - Auth token
  • gateway.auth.password - Auth password

Agents

  • agents.defaults.workspace - Default workspace directory
  • agents.defaults.model.primary - Primary model (e.g., anthropic:claude-4.5-sonnet)
  • agents.defaults.thinkingDefault - Default thinking level
  • agents.defaults.contextTokens - Max context tokens

Channels

  • channels.telegram.accounts.default.token - Telegram bot token
  • channels.discord.accounts.default.token - Discord bot token
  • channels.slack.accounts.default.botToken - Slack bot token
  • channels.slack.accounts.default.appToken - Slack app token

Discovery

  • discovery.wideArea.domain - Wide-area discovery domain

JSON5 Syntax

When setting complex values, use JSON5 syntax with --json:

Configuration File

The configuration file is located at ~/.openclaw/openclaw.json and supports:
  • JSON5 syntax - Comments, trailing commas, unquoted keys
  • Environment variables - ${ENV_VAR} substitution
  • Includes - $include: "path/to/other.json5"

Example Configuration

Environment Variable Substitution

Use ${VAR_NAME} in config values to reference environment variables:

Configuration Validation

The CLI validates configuration on load. Check for errors with:
Common validation issues:
  • Invalid JSON5 syntax
  • Missing required fields
  • Invalid enum values
  • Type mismatches

Backup and Migration

The CLI creates automatic backups when writing config:
To manually backup:
  • configure - Interactive configuration wizard
  • setup - Initialize local config and workspace
  • doctor - Validate and repair configuration