Home Tutorials Categories Skills About
ZH EN JA KO
Configuration

OpenClaw Startup Parameters and Command-Line Options Reference

· 19 min read

Introduction

The openclaw command-line tool is the primary interface for managing the AI gateway. Beyond configuration files, many behaviors can be temporarily overridden or adjusted through startup parameters. This article provides a complete listing of all openclaw subcommands and their options to help you use them flexibly across different scenarios.

Global Options

The following options apply to all subcommands:

openclaw [global options] <subcommand> [subcommand options]
Option Short Description
--config <path> -c Specify config file path, overriding the default ~/.openclaw/openclaw.json
--log-level <level> -l Log level: debug, info, warn, error
--quiet -q Quiet mode, output errors only
--verbose -v Verbose output mode, equivalent to --log-level debug
--no-color Disable colored terminal output
--version -V Display version number
--help -h Display help information

Examples

# Start with a custom config file
openclaw -c /etc/openclaw/production.json gateway

# Run in debug mode
openclaw -v gateway

# Check version
openclaw --version

gateway Command

gateway is the core command for starting the AI gateway service.

openclaw gateway [options]
Option Short Default Description
--port <number> -p 18789 Gateway listening port
--host <address> -H 127.0.0.1 Listening address
--daemon -d Run as a daemon (background)
--pid-file <path> ~/.openclaw/openclaw.pid PID file path
--workers <number> -w 0 (auto) Number of worker threads
--timeout <ms> -t 120000 Request timeout (milliseconds)
--no-dashboard Don't start the built-in Dashboard
--channels <list> All Enable only specified channels, comma-separated
--dry-run Validate config and simulate startup without actually running

Common Usage

# Default start
openclaw gateway

# Specify port and address
openclaw gateway --port 8080 --host 0.0.0.0

# Run in background
openclaw gateway --daemon

# Enable only Telegram and Discord channels
openclaw gateway --channels telegram,discord

# Validate configuration without starting (dry run)
openclaw gateway --dry-run

Daemon Management

After starting in --daemon mode, you can manage it with these commands:

# Check running status
openclaw status

# Graceful stop
openclaw stop

# Force stop
openclaw stop --force

# Restart
openclaw restart

# Hot reload configuration (without interrupting connections)
openclaw reload

dashboard Command

Start the Web Dashboard independently without starting the gateway service.

openclaw dashboard [options]
Option Short Default Description
--port <number> -p 18789 Dashboard port
--gateway <url> -g http://localhost:18789 Gateway address to connect to
--open -o Automatically open browser after starting
--no-auth Skip password authentication (development only)

Examples

# Start and open browser
openclaw dashboard --open

# Connect to a remote gateway
openclaw dashboard --gateway https://remote-server:18789

# Use a custom port
openclaw dashboard --port 3000

doctor Command

A diagnostic tool that checks configuration, dependencies, and connection status.

openclaw doctor [options]
Option Description
--config-only Only check config file syntax and required fields
--connectivity Test network connectivity for all configured channels and models
--remote Test whether external access works (requires webhookBase configuration)
--fix Automatically fix repairable issues (e.g., create missing directories)

Output Example

$ openclaw doctor

OpenClaw Diagnostic Report
==================

Configuration File
  ✓ Configuration file format is valid
  ✓ All required fields are set

Model Connections
  ✓ Claude API connection OK (latency: 230ms)
  ✓ OpenAI API connection OK (latency: 180ms)
  ✗ Ollama connection failed: ECONNREFUSED localhost:11434

Channel Status
  ✓ Telegram Bot authenticated
  ✓ Discord Bot logged in
  - WhatsApp not configured

System Environment
  ✓ Node.js v20.11.0
  ✓ Sufficient disk space (available: 50GB)
  ✓ Sufficient memory (available: 4.2GB)

Issues: 1
  1. Ollama service is not running. Please start Ollama or disable its model configuration

session Command

Manage conversation session data.

openclaw session <subcommand> [options]
Subcommand Description
list List all sessions
stats View session statistics
clear Clear session data
export Export a session
compact Manually trigger compaction
trim Trim history to a specified number of messages

Common Operations

# List all active sessions
openclaw session list

# Filter by Agent
openclaw session list --agent default

# View detailed statistics for a session
openclaw session stats --session telegram_123456

# Clear a specific session
openclaw session clear --session telegram_123456

# Clear all sessions for an Agent
openclaw session clear --agent default --all

# Export session as JSON
openclaw session export --session telegram_123456 --format json

# Manual compaction
openclaw session compact --session telegram_123456

# Keep only the last 20 messages
openclaw session trim --session telegram_123456 --keep 20

mobile Command

Manage mobile device pairing.

openclaw mobile <subcommand> [options]
Subcommand Description
pair Generate a pairing code or QR code
list List paired devices
remove Remove a device

Examples

# Generate a text pairing code
openclaw mobile pair --generate

# Generate a QR code
openclaw mobile pair --qrcode

# List devices
openclaw mobile list

# Remove a specific device
openclaw mobile remove mob_a3f2c1d8

# Remove all devices
openclaw mobile remove --all

config Command

View and manage configuration.

openclaw config <subcommand> [options]
Subcommand Description
--dump Output the full active configuration
--get <key> Get the value of a specific configuration key
--set <key> <value> Set a configuration value
--edit Open the configuration file in the system editor
--init Generate a default configuration file
--validate Validate the configuration file

Examples

# View full configuration
openclaw config --dump

# Get a specific config value
openclaw config --get gateway.port

# Set a config value
openclaw config --set gateway.port 8080

# Initialize default configuration
openclaw config --init

# Open in editor
openclaw config --edit

access Command

Manage access control and permissions.

openclaw access <subcommand> [options]
Subcommand Description
allow <id> Add a user or group to the allowlist
deny <id> Add a user or group to the blocklist
remove <id> Remove from the allowlist or blocklist
list List the current allowlist and blocklist
pair-code Generate a pairing code
log View access logs

Examples

# Add user to allowlist
openclaw access allow tg:123456789

# Block a user
openclaw access deny tg:999888777

# View the allowlist
openclaw access list

# View access logs
openclaw access log --tail 50

media Command

Manage media file cache.

openclaw media <subcommand>
Subcommand Description
cleanup Clean up media cache
stats View cache statistics

Environment Variables

Some startup parameters can also be set via environment variables. Environment variables take priority over configuration files but are overridden by command-line arguments:

Environment Variable Corresponding Parameter
OPENCLAW_CONFIG --config
OPENCLAW_PORT --port
OPENCLAW_HOST --host
OPENCLAW_LOG_LEVEL --log-level
OPENCLAW_DASHBOARD_PASSWORD Dashboard password
OPENCLAW_CLAUDE_API_KEY Claude API key
OPENCLAW_OPENAI_API_KEY OpenAI API key
OPENCLAW_TELEGRAM_TOKEN Telegram Bot Token

Priority order (highest to lowest): Command-line arguments > Environment variables > Configuration file > Default values.

systemd Service Configuration

On Linux servers, using systemd to manage OpenClaw is recommended:

# /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw AI Gateway
After=network.target

[Service]
Type=simple
User=openclaw
WorkingDirectory=/home/openclaw
ExecStart=/usr/local/bin/openclaw gateway --port 18789 --host 0.0.0.0
ExecReload=/usr/local/bin/openclaw reload
Restart=always
RestartSec=5
Environment=OPENCLAW_CONFIG=/etc/openclaw/openclaw.json

[Install]
WantedBy=multi-user.target
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw

Summary

The openclaw command-line tool provides a complete feature set from starting the gateway to managing sessions, from diagnosing issues to configuring permissions. In daily use, gateway, doctor, and session are the three most commonly used commands. Remember that command-line arguments take priority over configuration files — this means you can temporarily adjust gateway behavior through parameters without modifying the configuration file, which is ideal for debugging and testing.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms