CLI Usage Guide¶
The openclaw CLI provides commands for managing the gateway, configuration, and agents.
Global Options¶
| Option | Description |
|---|---|
--config <PATH> |
Use a specific config file |
--verbose, -v |
Enable verbose output |
--quiet, -q |
Suppress non-error output |
--help, -h |
Show help |
--version, -V |
Show version |
Commands Overview¶
| Command | Description |
|---|---|
onboard |
Interactive setup wizard |
gateway |
Gateway server management |
config |
Configuration management |
status |
Show system status |
doctor |
Run health checks |
sessions |
Session management |
onboard¶
Interactive setup wizard for first-time configuration.
Options¶
| Option | Description |
|---|---|
--non-interactive |
Skip interactive prompts |
--accept-risk |
Accept security notice |
--flow <FLOW> |
Setup flow (quickstart, full) |
--auth-choice <PROVIDER> |
Provider choice (anthropic, openai) |
--api-key <KEY> |
API key for the provider |
Examples¶
# Interactive setup
openclaw onboard
# Non-interactive for CI/CD
openclaw onboard \
--non-interactive \
--accept-risk \
--flow quickstart \
--auth-choice anthropic \
--api-key "sk-ant-..."
gateway¶
Manage the gateway server.
gateway run¶
Start the gateway server.
| Option | Description |
|---|---|
--port <PORT> |
Override port (default: 18789) |
--bind <ADDRESS> |
Override bind address |
--foreground |
Run in foreground (default) |
gateway stop¶
Stop a running gateway.
gateway restart¶
Restart the gateway.
Examples¶
# Start on custom port
openclaw gateway run --port 8080
# Start in background (via systemd)
sudo systemctl start openclaw
config¶
Manage configuration.
config show¶
Display current configuration.
| Format | Description |
|---|---|
json |
JSON output (default) |
yaml |
YAML output |
table |
Table format |
config get¶
Get a specific configuration value.
config set¶
Set a configuration value.
# Examples
openclaw config set gateway.port 8080
openclaw config set providers.openai.default_model gpt-4o
config validate¶
Validate the configuration file.
status¶
Show system status.
| Option | Description |
|---|---|
--json |
Output as JSON |
--watch |
Continuously update |
Example output:
OpenClaw Status
===============
Gateway: Running (http://127.0.0.1:18789)
Uptime: 2h 34m
Sessions: 3 active
Providers: anthropic (ok), openai (ok)
doctor¶
Run health checks and diagnostics.
| Option | Description |
|---|---|
--fix |
Attempt to fix issues |
--verbose |
Show detailed output |
Checks include:
- Configuration file validity
- Provider API connectivity
- Gateway availability
- Workspace permissions
- System dependencies
sessions¶
Manage conversation sessions.
sessions list¶
List all sessions.
| Option | Description |
|---|---|
--limit <N> |
Limit results |
--active |
Show only active sessions |
--json |
Output as JSON |
sessions show¶
Show session details.
sessions delete¶
Delete a session.
configure¶
Interactive configuration editor.
| Section | Description |
|---|---|
gateway |
Gateway settings |
auth |
Provider credentials |
agents |
Agent configuration |
all |
Full configuration |
Environment Variables¶
| Variable | Description |
|---|---|
OPENCLAW_CONFIG |
Path to config file |
OPENCLAW_LOG |
Log level (debug, info, warn, error) |
ANTHROPIC_API_KEY |
Anthropic API key |
OPENAI_API_KEY |
OpenAI API key |
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Connection error |
| 4 | Authentication error |
Next Steps¶
:material-robot: Provider Configuration :material-cog: Configuration Reference