附录 A:OpenClaw 配置参考
完整配置示例
{
// ── Gateway 服务器 ──────────────────────────────────────
"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": {
"scope": "per-sender", // "per-sender" | "global"
"mainKey": "main",
"store": "~/.openclaw/sessions"
},
// ── Agent 配置 ──────────────────────────────────────────
"agents": {
"defaults": {
"workspace": "~/openclaw-workspace",
"sandbox": {
"mode": "off" // "off" | "auto" | "always"
}
},
"list": [
{
"id": "main",
"name": "主助手",
"default": true,
"model": "claude-opus-4-6",
"skills": ["coding-agent", "github"],
"identity": "你是一个有帮助的 AI 助手。",
"subagents": {
"allowAgents": ["*"],
"model": "claude-sonnet-4-20250514"
}
}
]
},
// ── 模型配置 ────────────────────────────────────────────
"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}"
}
}
},
// ── 通道配置 ────────────────────────────────────────────
"channels": {
"telegram": {
"botToken": "${TELEGRAM_BOT_TOKEN}",
"allowedUsers": [123456789],
"dmPolicy": "pairing"
},
"discord": {
"botToken": "${DISCORD_BOT_TOKEN}",
"activation": "mention"
},
"whatsapp": {
"phoneNumber": "+1234567890"
}
},
// ── 工具配置 ────────────────────────────────────────────
"tools": {
"sandbox": {
"tools": {
"allow": ["exec", "read", "write", "edit", "image"],
"deny": ["browser", "canvas", "cron"]
}
}
},
// ── 记忆系统 ────────────────────────────────────────────
"memory": {
"embeddings": {
"provider": "openai",
"model": "text-embedding-3-small"
}
},
// ── 钩子系统 ────────────────────────────────────────────
"hooks": {
"plugins": []
}
}配置键速查表
路径
类型
默认值
说明
Last updated