> For the complete documentation index, see [llms.txt](https://www.openclawbook.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.openclawbook.xyz/en/appendices/appendix-a-openclaw-configuration-reference.md). Agents can also search and read this documentation through its [MCP server](https://www.openclawbook.xyz/~gitbook/mcp).

# Appendix A: OpenClaw Configuration Reference

> **Generated by**: Claude Opus 4.6 (initial draft) / Claude Opus 5 (`v2026.3.9` revision) **Token usage**: Input \~375k tokens, Output \~4k tokens (this section) **Source baseline**: `v2026.3.9` (`v2026.3.8-170-g665f67726`)

***

OpenClaw's configuration file is located at `~/.openclaw/openclaw.json` and uses JSON5 format (supports comments and trailing commas).

## Complete Configuration Example

```jsonc
{
  // ── Gateway Server ──────────────────────────────────────
  "gateway": {
    "port": 3000,
    "host": "127.0.0.1",
    "mode": "local",         // "local" | "remote"
    "auth": {
      "token": "your-secret-token",
      "password": "your-password"
    },
    "tls": {
      "autoGenerate": false,
      "certPath": "/path/to/cert.pem",
      "keyPath": "/path/to/key.pem"
    },
    "trustedProxies": ["127.0.0.1", "::1"],
    "tailscale": {
      "mode": "off"          // "off" | "serve" | "funnel"
    },
    "discovery": {
      "mdns": "minimal"      // "off" | "minimal" | "full"
    }
  },

  // ── Session Management ──────────────────────────────────
  "session": {
    "scope": "per-sender",   // "per-sender" | "global"
    "mainKey": "main",
    "store": "~/.openclaw/sessions"
  },

  // ── Agent Configuration ─────────────────────────────────
  "agents": {
    "defaults": {
      "workspace": "~/openclaw-workspace",
      "sandbox": {
        "mode": "off"        // "off" | "auto" | "always"
      }
    },
    "list": [
      {
        "id": "main",
        "name": "Main Assistant",
        "default": true,
        "model": "claude-opus-4-6",
        "skills": ["coding-agent", "github"],
        "identity": "You are a helpful AI assistant.",
        "subagents": {
          "allowAgents": ["*"],
          "model": "claude-sonnet-4-20250514"
        }
      }
    ]
  },

  // ── Model Configuration ─────────────────────────────────
  "models": {
    "default": "claude-opus-4-6",
    "fallbacks": ["claude-sonnet-4-20250514"],
    "providers": {
      "anthropic": {
        "apiKey": "${ANTHROPIC_API_KEY}",
        "models": [
          {
            "id": "claude-opus-4-6",
            "cost": { "input": 15, "output": 75, "cacheRead": 1.5, "cacheWrite": 18.75 }
          }
        ]
      },
      "openai": {
        "apiKey": "${OPENAI_API_KEY}"
      }
    }
  },

  // ── Channel Configuration ───────────────────────────────
  "channels": {
    "telegram": {
      "botToken": "${TELEGRAM_BOT_TOKEN}",
      "allowedUsers": [123456789],
      "dmPolicy": "pairing"
    },
    "discord": {
      "botToken": "${DISCORD_BOT_TOKEN}",
      "activation": "mention"
    },
    "whatsapp": {
      "phoneNumber": "+1234567890"
    }
  },

  // ── Tool Configuration ──────────────────────────────────
  "tools": {
    "sandbox": {
      "tools": {
        "allow": ["exec", "read", "write", "edit", "image"],
        "deny": ["browser", "canvas", "cron"]
      }
    }
  },

  // ── Memory System ───────────────────────────────────────
  "memory": {
    "embeddings": {
      "provider": "openai",
      "model": "text-embedding-3-small"
    }
  },

  // ── Hook System ─────────────────────────────────────────
  "hooks": {
    "plugins": []
  }
}
```

## Configuration Key Quick Reference

| Path                                  | Type          | Default             | Description                       |
| ------------------------------------- | ------------- | ------------------- | --------------------------------- |
| `gateway.port`                        | number        | `3000`              | WebSocket server port             |
| `gateway.host`                        | string        | `"127.0.0.1"`       | Listen address                    |
| `gateway.mode`                        | string        | `"local"`           | Operation mode                    |
| `gateway.auth.token`                  | string        | —                   | Authentication token              |
| `gateway.auth.password`               | string        | —                   | Authentication password           |
| `session.scope`                       | string        | `"per-sender"`      | Session scope                     |
| `session.mainKey`                     | string        | `"main"`            | Main session key                  |
| `agents.list[]`                       | array         | `[]`                | Agent list                        |
| `agents.list[].id`                    | string        | —                   | Agent unique identifier           |
| `agents.list[].default`               | boolean       | `false`             | Whether this is the default Agent |
| `agents.list[].model`                 | string/object | —                   | Model configuration               |
| `agents.list[].skills`                | string\[]     | —                   | Enabled skills list               |
| `agents.list[].workspace`             | string        | —                   | Workspace path                    |
| `agents.list[].sandbox.mode`          | string        | `"off"`             | Sandbox mode                      |
| `agents.list[].subagents.allowAgents` | string\[]     | —                   | Allowed sub-agent IDs             |
| `models.default`                      | string        | `"claude-opus-4-6"` | Default model                     |
| `models.fallbacks`                    | string\[]     | —                   | Model fallback chain              |
| `models.providers`                    | object        | —                   | Provider configuration            |
| `channels.telegram.botToken`          | string        | —                   | Telegram Bot Token                |
| `channels.telegram.dmPolicy`          | string        | `"pairing"`         | DM security policy                |
| `channels.discord.botToken`           | string        | —                   | Discord Bot Token                 |
| `channels.discord.activation`         | string        | `"mention"`         | Group chat activation method      |
| `tools.sandbox.tools.allow`           | string\[]     | See Section 39.3    | Sandbox tool whitelist            |
| `tools.sandbox.tools.deny`            | string\[]     | See Section 39.3    | Sandbox tool blacklist            |
| `memory.embeddings.provider`          | string        | —                   | Embedding vector provider         |

> Configuration files support `${ENV_VAR}` syntax for environment variable substitution (see Section 31.5).
