CLI Command Reference¶
Complete reference for all openclaw CLI commands.
Synopsis¶
Global Options¶
| Option | Short | Description |
|---|---|---|
--config <PATH> |
-c |
Use specific config file |
--verbose |
-v |
Enable verbose output |
--quiet |
-q |
Suppress non-error output |
--help |
-h |
Show help |
--version |
-V |
Show version |
onboard¶
Interactive setup wizard.
Synopsis¶
Options¶
| Option | Description |
|---|---|
--non-interactive |
Skip interactive prompts |
--accept-risk |
Accept security acknowledgment |
--flow <FLOW> |
Setup flow: quickstart, full |
--auth-choice <PROVIDER> |
Provider: anthropic, openai, both |
--api-key <KEY> |
API key for provider |
--skip-service |
Skip service installation |
Examples¶
# Interactive setup
openclaw onboard
# Automated setup
openclaw onboard \
--non-interactive \
--accept-risk \
--flow quickstart \
--auth-choice anthropic \
--api-key "sk-ant-..."
# Full setup with both providers
openclaw onboard --flow full --auth-choice both
gateway¶
Gateway server management.
gateway run¶
Start the gateway server.
| Option | Description |
|---|---|
--port <PORT> |
Override configured port |
--bind <ADDRESS> |
Override bind address |
--foreground |
Run in foreground (default) |
# Start with defaults
openclaw gateway run
# Custom port
openclaw gateway run --port 8080
# Bind to all interfaces
openclaw gateway run --bind 0.0.0.0
gateway stop¶
Stop the running gateway.
gateway restart¶
Restart the gateway.
gateway status¶
Show gateway status.
config¶
Configuration management.
config show¶
Display current configuration.
| Option | Description |
|---|---|
--format <FORMAT> |
Output format: json, yaml, table |
--section <SECTION> |
Show specific section |
# Show all
openclaw config show
# JSON format
openclaw config show --format json
# Specific section
openclaw config show --section gateway
config get¶
Get a configuration value.
openclaw config get gateway.port
# Output: 18789
openclaw config get providers.anthropic.default_model
# Output: claude-3-5-sonnet-20241022
config set¶
Set a configuration value.
config validate¶
Validate configuration file.
openclaw config validate
# Output: Configuration is valid
openclaw config validate --strict
# Checks for warnings too
config path¶
Show configuration file path.
configure¶
Interactive configuration editor.
| Option | Description |
|---|---|
--section <SECTION> |
Configure section: gateway, auth, agents, all |
# Configure authentication
openclaw configure --section auth
# Full configuration
openclaw configure --section all
status¶
Show system status.
| Option | Description |
|---|---|
--json |
Output as JSON |
--watch |
Continuously update |
--interval <SECS> |
Watch interval (default: 2) |
openclaw status
# Example output:
# OpenClaw Status
# ===============
# Gateway: Running (http://127.0.0.1:18789)
# Uptime: 2h 34m
# Sessions: 3 active
# Providers: anthropic (ok), openai (ok)
# Memory: 45.2 MB
# CPU: 0.1%
openclaw status --json
openclaw status --watch
doctor¶
Run health checks.
| Option | Description |
|---|---|
--fix |
Attempt to fix issues |
--verbose |
Show detailed output |
--check <CHECK> |
Run specific check |
openclaw doctor
# Example output:
# Health Check Results
# ====================
# ✓ Configuration file exists
# ✓ Configuration is valid
# ✓ Anthropic API accessible
# ✓ OpenAI API accessible
# ✓ Gateway is running
# ✓ Workspace exists and writable
# ✓ Required dependencies installed
#
# All checks passed!
openclaw doctor --fix
openclaw doctor --verbose
Available Checks¶
| Check | Description |
|---|---|
config |
Configuration validity |
providers |
Provider API connectivity |
gateway |
Gateway availability |
workspace |
Workspace permissions |
deps |
System dependencies |
sessions¶
Session management.
sessions list¶
List all sessions.
| Option | Description |
|---|---|
--limit <N> |
Limit results |
--offset <N> |
Skip first N results |
--active |
Show only active |
--json |
Output as JSON |
--sort <FIELD> |
Sort by: created, updated, messages |
sessions show¶
Show session details.
| Option | Description |
|---|---|
--json |
Output as JSON |
--messages |
Include all messages |
sessions delete¶
Delete a session.
| Option | Description |
|---|---|
--force |
Skip confirmation |
sessions export¶
Export a session.
| Option | Description |
|---|---|
--format <FORMAT> |
Format: json, markdown, text |
--output <PATH> |
Output file path |
openclaw sessions export abc123 --format markdown
openclaw sessions export abc123 --format json --output session.json
sessions clear¶
Clear all sessions.
| Option | Description |
|---|---|
--force |
Skip confirmation |
--older-than <DAYS> |
Only clear older sessions |
agents¶
Agent management.
agents list¶
List configured agents.
| Option | Description |
|---|---|
--json |
Output as JSON |
agents show¶
Show agent configuration.
agents create¶
Create a new agent.
| Option | Description |
|---|---|
--provider <PROVIDER> |
AI provider |
--model <MODEL> |
Model to use |
--system-prompt <PROMPT> |
System prompt |
--interactive |
Interactive creation |
tools¶
Tool management.
tools list¶
List available tools.
| Option | Description |
|---|---|
--json |
Output as JSON |
--enabled |
Show only enabled |
tools show¶
Show tool details.
Environment Variables¶
| Variable | Description |
|---|---|
OPENCLAW_CONFIG |
Config file path |
OPENCLAW_LOG |
Log level: debug, info, warn, error |
ANTHROPIC_API_KEY |
Anthropic API key |
OPENAI_API_KEY |
OpenAI API key |
NO_COLOR |
Disable colored output |
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Connection error |
| 4 | Authentication error |
| 5 | Not found |
| 126 | Permission denied |
| 130 | Interrupted (Ctrl+C) |
Next Steps¶
:material-swap-horizontal: OpenClaw Compatibility :material-rocket-launch: Quick Start