create-openclaw-bot 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -17
- package/README.vi.md +18 -17
- package/{cli.js → dist/cli.js} +295 -224
- package/dist/setup/shared/install-gen.js +485 -0
- package/{setup/shared/scaffold-gen.js → dist/setup/shared/workspace-gen.js} +247 -25
- package/{setup.js → dist/setup.js} +771 -1158
- package/package.json +10 -7
- package/.github/workflows/check-openclaw-update.yml +0 -106
- package/CHANGELOG.md +0 -602
- package/CHANGELOG.vi.md +0 -588
- package/docs/SETUP.md +0 -532
- package/docs/SETUP.vi.md +0 -439
- package/docs/ai-providers.md +0 -144
- package/docs/ai-providers.vi.md +0 -144
- package/docs/browser-automation-guide.md +0 -207
- package/docs/faq.md +0 -63
- package/docs/faq.vi.md +0 -63
- package/docs/hardware-guide.md +0 -55
- package/docs/hardware-guide.vi.md +0 -55
- package/docs/install-docker.md +0 -161
- package/docs/install-docker.vi.md +0 -161
- package/docs/install-native.md +0 -96
- package/docs/install-native.vi.md +0 -96
- package/docs/preview.png +0 -0
- package/docs/skills-plugins-guide.md +0 -126
- package/index.html +0 -589
- package/old_v510.js +0 -0
- package/setup/shared/runtime-gen.js +0 -710
- package/style.css +0 -1653
- package/upgrade.ps1 +0 -90
- package/upgrade.sh +0 -93
- /package/{setup → dist/setup}/data/channels.js +0 -0
- /package/{setup → dist/setup}/data/header.js +0 -0
- /package/{setup → dist/setup}/data/index.js +0 -0
- /package/{setup → dist/setup}/data/plugins.js +0 -0
- /package/{setup → dist/setup}/data/providers.js +0 -0
- /package/{setup → dist/setup}/data/skills.js +0 -0
- /package/{setup → dist/setup}/shared/common-gen.js +0 -0
- /package/{setup → dist/setup}/shared/docker-gen.js +0 -0
package/docs/SETUP.vi.md
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
# 🦞 OpenClaw — Hướng Dẫn Kỹ Thuật (cho AI Agent)
|
|
2
|
-
|
|
3
|
-
> **File này dành cho AI Agent (Antigravity) đọc và thực thi tự động.**
|
|
4
|
-
> Người dùng đã tạo sẵn file `.env` chứa API key và Bot token. AI **TUYỆT ĐỐI KHÔNG** được yêu cầu hoặc nhận credentials qua chat.
|
|
5
|
-
|
|
6
|
-
[English](SETUP.md) · [Tiếng Việt](#-quy-tắc-bảo-mật--bắt-buộc)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🔐 Quy Tắc Bảo Mật — BẮT BUỘC
|
|
11
|
-
|
|
12
|
-
> **AI Agent BẮT BUỘC tuân thủ TẤT CẢ quy tắc bên dưới. Vi phạm = DỪNG ngay.**
|
|
13
|
-
|
|
14
|
-
### File & thư mục hệ thống
|
|
15
|
-
|
|
16
|
-
- ❌ **KHÔNG** đọc, sao chép, hoặc truy cập bất kỳ file nào ngoài thư mục project
|
|
17
|
-
- ❌ **KHÔNG** quét hoặc liệt kê các thư mục hệ thống: `Documents`, `Desktop`, `Downloads`, `AppData`, `%USERPROFILE%`
|
|
18
|
-
- ❌ **KHÔNG** truy cập registry, system32, hoặc Program Files
|
|
19
|
-
- ❌ **KHÔNG** cài đặt phần mềm, driver, hoặc service ngoài Docker
|
|
20
|
-
- ❌ **KHÔNG** sửa đổi biến môi trường hệ thống
|
|
21
|
-
- ✅ **CHỈ** làm việc trong thư mục project do người dùng chỉ định
|
|
22
|
-
|
|
23
|
-
### API key & credentials
|
|
24
|
-
|
|
25
|
-
- ❌ **KHÔNG BAO GIỜ** hiển thị API key, token, hoặc mật khẩu trong chat
|
|
26
|
-
- ❌ **KHÔNG** viết API key trực tiếp vào mã nguồn
|
|
27
|
-
- ❌ **KHÔNG** commit file credentials lên Git
|
|
28
|
-
- ✅ **LUÔN** lưu credentials trong file `.env` riêng
|
|
29
|
-
- ✅ **LUÔN** thêm `.env` vào `.gitignore`
|
|
30
|
-
- ✅ **LUÔN** dùng biến môi trường (`${VAR}`) thay vì hardcode
|
|
31
|
-
|
|
32
|
-
### Ví crypto & tài sản số
|
|
33
|
-
|
|
34
|
-
- ❌ **TUYỆT ĐỐI KHÔNG** truy cập, đọc, hoặc quét các thư mục ví crypto:
|
|
35
|
-
- Metamask, Trust Wallet, Phantom, Exodus, Electrum
|
|
36
|
-
- File: `wallet.dat`, `keystore/`, seed phrases, private keys
|
|
37
|
-
- Extension trình duyệt chứa ví crypto
|
|
38
|
-
- ❌ **KHÔNG** quét clipboard (có thể chứa seed phrases)
|
|
39
|
-
- ❌ **KHÔNG** truy cập browser profile, cookie, hoặc mật khẩu đã lưu
|
|
40
|
-
- ❌ **KHÔNG** cài đặt npm package lạ (chỉ `openclaw` và plugin chính thức)
|
|
41
|
-
|
|
42
|
-
### Docker
|
|
43
|
-
|
|
44
|
-
- ✅ Chỉ mount **đúng** thư mục cần thiết (config + workspace)
|
|
45
|
-
- ❌ **KHÔNG** mount nguyên ổ đĩa (`C:/` hoặc `D:/`)
|
|
46
|
-
- ❌ **KHÔNG** chạy container với `--privileged`
|
|
47
|
-
- ✅ Giới hạn port expose (chỉ `18789`)
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 📂 Cấu Trúc Thư Mục Sau Setup
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
<PROJECT_DIR>/
|
|
55
|
-
├── .openclaw/ ← Config chính (KHÔNG commit)
|
|
56
|
-
│ ├── openclaw.json ← Gateway, agent, channel config
|
|
57
|
-
│ ├── auth-profiles.json ← API key profile
|
|
58
|
-
│ ├── credentials/
|
|
59
|
-
│ │ └── <provider> ← API key của nhà cung cấp AI
|
|
60
|
-
│ ├── agents/
|
|
61
|
-
│ │ └── <agent-name>.yaml ← Định nghĩa agent (chỉ name + model)
|
|
62
|
-
│ ├── workspace/ ← ⭐ Persona & hành vi bot
|
|
63
|
-
│ │ ├── IDENTITY.md ← Tên bot, emoji, vibe
|
|
64
|
-
│ │ ├── SOUL.md ← Tính cách, ranh giới
|
|
65
|
-
│ │ ├── AGENTS.md ← Quy tắc vận hành
|
|
66
|
-
│ │ ├── USER.md ← Thông tin người dùng
|
|
67
|
-
│ │ ├── TOOLS.md ← Hướng dẫn dùng tools
|
|
68
|
-
│ │ └── MEMORY.md ← Bộ nhớ dài hạn
|
|
69
|
-
│ ├── skills/ ← Slash commands (tùy chọn)
|
|
70
|
-
│ ├── identity/
|
|
71
|
-
│ │ └── device.json ← Device keypair
|
|
72
|
-
│ ├── memory/ ← Bộ nhớ agent (SQLite)
|
|
73
|
-
│ ├── cron/jobs.json
|
|
74
|
-
│ └── logs/
|
|
75
|
-
│ └── config-audit.jsonl
|
|
76
|
-
│
|
|
77
|
-
├── docker/openclaw/
|
|
78
|
-
│ ├── Dockerfile
|
|
79
|
-
│ ├── docker-compose.yml
|
|
80
|
-
│ └── .env ← API keys (KHÔNG commit)
|
|
81
|
-
│
|
|
82
|
-
└── .gitignore
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 🔌 Kênh & Model Hỗ Trợ
|
|
88
|
-
|
|
89
|
-
### Kênh chat
|
|
90
|
-
|
|
91
|
-
| Kênh | Key trong .env | Plugin cần cài |
|
|
92
|
-
|------|---------------|----------------|
|
|
93
|
-
| **Telegram** | `TELEGRAM_BOT_TOKEN` | Không (built-in) |
|
|
94
|
-
| **Zalo Bot API** | `ZALO_BOT_TOKEN` | `@openclaw/zalo` |
|
|
95
|
-
| **Zalo Cá nhân** | Không cần | `@openclaw/zalouser` |
|
|
96
|
-
|
|
97
|
-
### Nhà cung cấp AI
|
|
98
|
-
|
|
99
|
-
| Nhà cung cấp | Key trong .env | Model ID format |
|
|
100
|
-
|--------------|---------------|-----------------|
|
|
101
|
-
| **Google Gemini** | `GOOGLE_API_KEY` | `google/gemini-2.5-flash` |
|
|
102
|
-
| **Anthropic Claude** | `ANTHROPIC_API_KEY` | `anthropic/claude-sonnet-4` |
|
|
103
|
-
| **OpenAI** | `OPENAI_API_KEY` | `openai/gpt-4o` |
|
|
104
|
-
| **OpenRouter** | `OPENROUTER_API_KEY` | `openrouter/model-name` |
|
|
105
|
-
| **Ollama** | `OLLAMA_HOST` | `ollama/qwen3:8b` |
|
|
106
|
-
|
|
107
|
-
### Logic phát hiện kênh:
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
NẾU .env chứa TELEGRAM_BOT_TOKEN → Kênh = Telegram
|
|
111
|
-
NẾU .env chứa ZALO_BOT_TOKEN → Kênh = Zalo Bot API
|
|
112
|
-
NGƯỢC LẠI → Kênh = Zalo Cá nhân (hoặc hỏi người dùng)
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Logic phát hiện AI provider:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
NẾU .env chứa GOOGLE_API_KEY → Provider = Google Gemini
|
|
119
|
-
NẾU .env chứa ANTHROPIC_API_KEY → Provider = Anthropic
|
|
120
|
-
NẾU .env chứa OPENAI_API_KEY → Provider = OpenAI
|
|
121
|
-
NẾU .env chứa OPENROUTER_API_KEY → Provider = OpenRouter
|
|
122
|
-
NẾU .env chứa OLLAMA_HOST → Provider = Ollama
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## ⚙️ Các Bước Setup
|
|
128
|
-
|
|
129
|
-
### Bước 1: Tạo thư mục
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
mkdir -p <PROJECT_DIR>/docker/openclaw
|
|
133
|
-
mkdir -p <PROJECT_DIR>/.openclaw/credentials
|
|
134
|
-
mkdir -p <PROJECT_DIR>/.openclaw/agents
|
|
135
|
-
mkdir -p <PROJECT_DIR>/.openclaw/skills
|
|
136
|
-
mkdir -p <PROJECT_DIR>/.openclaw/identity
|
|
137
|
-
mkdir -p <PROJECT_DIR>/.openclaw/memory
|
|
138
|
-
mkdir -p <PROJECT_DIR>/.openclaw/cron
|
|
139
|
-
mkdir -p <PROJECT_DIR>/.openclaw/logs
|
|
140
|
-
mkdir -p <PROJECT_DIR>/.openclaw/completions
|
|
141
|
-
mkdir -p <PROJECT_DIR>/.openclaw/canvas
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Bước 2: Tạo Dockerfile
|
|
145
|
-
|
|
146
|
-
Tạo `<PROJECT_DIR>/docker/openclaw/Dockerfile`:
|
|
147
|
-
|
|
148
|
-
#### Telegram (không cần plugin):
|
|
149
|
-
|
|
150
|
-
```dockerfile
|
|
151
|
-
FROM node:22-slim
|
|
152
|
-
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
153
|
-
RUN npm install -g openclaw@latest
|
|
154
|
-
WORKDIR /root/.openclaw
|
|
155
|
-
EXPOSE 18789
|
|
156
|
-
CMD ["openclaw", "gateway", "run"]
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
#### Zalo Bot API:
|
|
160
|
-
|
|
161
|
-
```dockerfile
|
|
162
|
-
FROM node:22-slim
|
|
163
|
-
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
164
|
-
RUN npm install -g openclaw@latest
|
|
165
|
-
RUN openclaw plugins install @openclaw/zalo
|
|
166
|
-
WORKDIR /root/.openclaw
|
|
167
|
-
EXPOSE 18789
|
|
168
|
-
CMD ["openclaw", "gateway", "run"]
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
#### Zalo Cá nhân:
|
|
172
|
-
|
|
173
|
-
```dockerfile
|
|
174
|
-
FROM node:22-slim
|
|
175
|
-
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
176
|
-
RUN npm install -g openclaw@latest
|
|
177
|
-
RUN openclaw plugins install @openclaw/zalouser
|
|
178
|
-
WORKDIR /root/.openclaw
|
|
179
|
-
EXPOSE 18789
|
|
180
|
-
CMD ["openclaw", "gateway", "run"]
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
#### Có thêm plugin (ví dụ Browser + Memory):
|
|
184
|
-
|
|
185
|
-
```dockerfile
|
|
186
|
-
FROM node:22-slim
|
|
187
|
-
RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
|
|
188
|
-
RUN npm install -g openclaw@latest
|
|
189
|
-
# Cài plugin kênh chat + plugin mở rộng
|
|
190
|
-
RUN openclaw plugins install @openclaw/zalo @openclaw/browser @openclaw/memory
|
|
191
|
-
WORKDIR /root/.openclaw
|
|
192
|
-
EXPOSE 18789
|
|
193
|
-
CMD ["openclaw", "gateway", "run"]
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Bước 3: Tạo docker-compose.yml
|
|
197
|
-
|
|
198
|
-
Tạo `<PROJECT_DIR>/docker/openclaw/docker-compose.yml`:
|
|
199
|
-
|
|
200
|
-
```yaml
|
|
201
|
-
services:
|
|
202
|
-
ai-bot:
|
|
203
|
-
build: .
|
|
204
|
-
container_name: openclaw-bot
|
|
205
|
-
restart: always
|
|
206
|
-
env_file:
|
|
207
|
-
- .env
|
|
208
|
-
extra_hosts:
|
|
209
|
-
- "host.docker.internal:host-gateway"
|
|
210
|
-
volumes:
|
|
211
|
-
- <PROJECT_DIR>/.openclaw:/root/.openclaw
|
|
212
|
-
ports:
|
|
213
|
-
- "18789:18789"
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
> Thay `<PROJECT_DIR>` bằng đường dẫn tuyệt đối thực tế. Ví dụ: `D:/MyAIBot/.openclaw:/root/.openclaw`
|
|
217
|
-
|
|
218
|
-
### Bước 4: Kiểm tra file .env (do người dùng đã tạo)
|
|
219
|
-
|
|
220
|
-
File `.env` đã được người dùng tạo tại `<PROJECT_DIR>/docker/openclaw/.env`.
|
|
221
|
-
|
|
222
|
-
**AI Agent PHẢI kiểm tra:**
|
|
223
|
-
1. File `.env` **tồn tại** tại `<PROJECT_DIR>/docker/openclaw/.env`
|
|
224
|
-
2. File chứa ít nhất 1 API key hợp lệ
|
|
225
|
-
3. **KHÔNG** đọc hoặc hiển thị giá trị key trong chat
|
|
226
|
-
|
|
227
|
-
Nếu file không tồn tại → **DỪNG** và yêu cầu người dùng tạo theo hướng dẫn trong README.
|
|
228
|
-
|
|
229
|
-
> **KHÔNG BAO GIỜ** tạo file `.env` thay người dùng. **KHÔNG BAO GIỜ** yêu cầu credentials qua chat.
|
|
230
|
-
|
|
231
|
-
### Bước 5: Tạo .gitignore
|
|
232
|
-
|
|
233
|
-
Tạo `<PROJECT_DIR>/.gitignore`:
|
|
234
|
-
|
|
235
|
-
```gitignore
|
|
236
|
-
# Credentials
|
|
237
|
-
.openclaw/credentials/
|
|
238
|
-
.openclaw/auth-profiles.json
|
|
239
|
-
.openclaw/openclaw.json
|
|
240
|
-
.openclaw/identity/
|
|
241
|
-
docker/openclaw/.env
|
|
242
|
-
|
|
243
|
-
# Runtime data
|
|
244
|
-
.openclaw/memory/
|
|
245
|
-
.openclaw/logs/
|
|
246
|
-
.openclaw/completions/
|
|
247
|
-
.openclaw/telegram/
|
|
248
|
-
.openclaw/canvas/
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Bước 6: Tạo cấu hình OpenClaw
|
|
252
|
-
|
|
253
|
-
**AI Agent thực hiện:**
|
|
254
|
-
|
|
255
|
-
1. Đọc API key (và channel token nếu có) từ `.env`
|
|
256
|
-
2. Phát hiện kênh chat và AI provider theo logic ở trên
|
|
257
|
-
3. Generate random gateway auth token
|
|
258
|
-
4. Ghi giá trị vào các file config bên dưới
|
|
259
|
-
5. **KHÔNG** hiển thị key/token trong chat
|
|
260
|
-
|
|
261
|
-
**Generate gateway auth token:**
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
#### Config cho Telegram + Google Gemini (ví dụ):
|
|
268
|
-
|
|
269
|
-
**Tạo `<PROJECT_DIR>/.openclaw/openclaw.json`:**
|
|
270
|
-
|
|
271
|
-
```json
|
|
272
|
-
{
|
|
273
|
-
"meta": { "lastTouchedVersion": "2026.3.27" },
|
|
274
|
-
"agents": {
|
|
275
|
-
"defaults": {
|
|
276
|
-
"model": { "primary": "google/gemini-2.5-flash", "fallbacks": [] },
|
|
277
|
-
"compaction": { "mode": "safeguard" }
|
|
278
|
-
},
|
|
279
|
-
"list": []
|
|
280
|
-
},
|
|
281
|
-
"commands": {
|
|
282
|
-
"native": "auto",
|
|
283
|
-
"nativeSkills": "auto",
|
|
284
|
-
"restart": true,
|
|
285
|
-
"ownerDisplay": "raw"
|
|
286
|
-
},
|
|
287
|
-
"channels": {
|
|
288
|
-
"telegram": {
|
|
289
|
-
"enabled": true,
|
|
290
|
-
"dmPolicy": "open",
|
|
291
|
-
"botToken": "<BOT_TOKEN_TỪ_.ENV>",
|
|
292
|
-
"allowFrom": ["*"],
|
|
293
|
-
"groupPolicy": "allowlist",
|
|
294
|
-
"streaming": "partial"
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
"gateway": {
|
|
298
|
-
"port": 18789,
|
|
299
|
-
"mode": "local",
|
|
300
|
-
"auth": { "mode": "token", "token": "<GATEWAY_TOKEN_ĐÃ_GENERATE>" }
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
#### Config kênh Zalo Bot API:
|
|
306
|
-
|
|
307
|
-
Thay phần `channels` bằng:
|
|
308
|
-
|
|
309
|
-
```json
|
|
310
|
-
{ "channels": { "zalo": { "enabled": true, "botToken": "<ZALO_BOT_TOKEN_TỪ_.ENV>" } } }
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
#### Config kênh Zalo Cá nhân:
|
|
314
|
-
|
|
315
|
-
Thay phần `channels` bằng:
|
|
316
|
-
|
|
317
|
-
```json
|
|
318
|
-
{ "channels": { "zalouser": { "enabled": true } } }
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
> **Lưu ý:** Zalo Cá nhân cần quét QR code sau khi container chạy. Xem QR trong logs: `docker logs openclaw-bot`
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
**Tạo `<PROJECT_DIR>/.openclaw/auth-profiles.json`** — dùng API key tương ứng:
|
|
326
|
-
|
|
327
|
-
```json
|
|
328
|
-
{ "gemini": { "apiKey": "<GOOGLE_API_KEY_TỪ_.ENV>" } }
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
_(Đổi `gemini` thành `anthropic`, `openai`, `openrouter` tùy provider)_
|
|
332
|
-
|
|
333
|
-
**Tạo `<PROJECT_DIR>/.openclaw/credentials/<provider>`** — ghi API key (1 dòng, không xuống dòng).
|
|
334
|
-
|
|
335
|
-
**Tạo `<PROJECT_DIR>/.openclaw/cron/jobs.json`:**
|
|
336
|
-
|
|
337
|
-
```json
|
|
338
|
-
{ "version": 1, "jobs": [] }
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Bước 7: Tạo Agent & Workspace Files
|
|
342
|
-
|
|
343
|
-
#### 7a. Agent YAML (chỉ metadata, KHÔNG chứa system_prompt)
|
|
344
|
-
|
|
345
|
-
Tạo file YAML tại `.openclaw/agents/<tên>.yaml`. Ví dụ — `.openclaw/agents/chat.yaml`:
|
|
346
|
-
|
|
347
|
-
```yaml
|
|
348
|
-
name: chat
|
|
349
|
-
description: "Trợ lý AI cá nhân"
|
|
350
|
-
|
|
351
|
-
model:
|
|
352
|
-
primary: google/gemini-2.5-flash
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
> **Lưu ý:** File YAML chỉ khai báo `name`, `description`, `model`. Tính cách bot nằm ở workspace files bên dưới.
|
|
356
|
-
|
|
357
|
-
#### 7b. Workspace Markdown Files (⭐ Bot nhận diện từ đây)
|
|
358
|
-
|
|
359
|
-
OpenClaw **tự động inject** tất cả file `.md` trong `.openclaw/workspace/` vào context đầu mỗi session. Đây là cách bot "biết" tên mình, tính cách, và quy tắc.
|
|
360
|
-
|
|
361
|
-
| File | Mục đích | Bắt buộc |
|
|
362
|
-
|------|----------|----------|
|
|
363
|
-
| `IDENTITY.md` | Tên bot, emoji, cách xưng hô | ✅ |
|
|
364
|
-
| `SOUL.md` | Tính cách, phong cách, ranh giới | ✅ |
|
|
365
|
-
| `AGENTS.md` | Quy tắc vận hành, cách trả lời | ✅ |
|
|
366
|
-
| `USER.md` | Thông tin về user (ngôn ngữ, sở thích) | Nên có |
|
|
367
|
-
| `TOOLS.md` | Hướng dẫn dùng tool/skill | Nên có |
|
|
368
|
-
| `MEMORY.md` | Bộ nhớ dài hạn (bot tự cập nhật) | Tùy chọn |
|
|
369
|
-
|
|
370
|
-
> **Thứ tự ưu tiên:** Per-agent files (`.openclaw/agents/<id>/`) → Global workspace files (`.openclaw/workspace/`) → Config defaults.
|
|
371
|
-
|
|
372
|
-
> **Bảo mật hệ thống** (không xóa file, không truy cập thư mục nhạy cảm, không lộ API key...) được OpenClaw **tự động áp dụng** — không cần viết vào workspace files.
|
|
373
|
-
|
|
374
|
-
#### 7c. Cập nhật `openclaw.json`
|
|
375
|
-
|
|
376
|
-
Thêm agent vào `agents.list`:
|
|
377
|
-
|
|
378
|
-
```json
|
|
379
|
-
{
|
|
380
|
-
"agents": {
|
|
381
|
-
"list": [
|
|
382
|
-
{ "id": "chat", "model": { "primary": "google/gemini-2.5-flash", "fallbacks": [] } }
|
|
383
|
-
]
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Bước 8: Build & Chạy
|
|
389
|
-
|
|
390
|
-
```bash
|
|
391
|
-
cd <PROJECT_DIR>/docker/openclaw
|
|
392
|
-
docker compose build
|
|
393
|
-
docker compose up -d
|
|
394
|
-
docker logs -f openclaw-bot
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### Bước 9: Kiểm tra
|
|
398
|
-
|
|
399
|
-
**Telegram:**
|
|
400
|
-
1. Mở Telegram → Tìm bot của bạn
|
|
401
|
-
2. Gửi tin nhắn bất kỳ
|
|
402
|
-
3. Bot trả lời = **Thành công!** 🎉
|
|
403
|
-
|
|
404
|
-
**Zalo Bot API:**
|
|
405
|
-
1. Mở Zalo → Tìm bot
|
|
406
|
-
2. Gửi tin nhắn
|
|
407
|
-
3. Bot trả lời = **Thành công!** 🎉
|
|
408
|
-
|
|
409
|
-
**Zalo Cá nhân:**
|
|
410
|
-
1. Xem `docker logs openclaw-bot` để lấy QR code
|
|
411
|
-
2. Quét QR bằng app Zalo
|
|
412
|
-
3. Gửi tin nhắn từ tài khoản Zalo khác
|
|
413
|
-
4. Bot trả lời = **Thành công!** 🎉
|
|
414
|
-
|
|
415
|
-
Nếu bot không phản hồi:
|
|
416
|
-
|
|
417
|
-
```bash
|
|
418
|
-
docker logs openclaw-bot --tail 50
|
|
419
|
-
docker compose restart
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
Nếu bot **không tạo được cron job** (lỗi "pairing required"):
|
|
423
|
-
|
|
424
|
-
```bash
|
|
425
|
-
docker exec -i openclaw-bot openclaw devices approve --latest
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
> **Lưu ý:** Từ OpenClaw v2026.3.x, gateway yêu cầu device pairing cho CLI connections. Dockerfile đã tự động approve khi khởi động, nhưng nếu lỗi vẫn xảy ra, chạy lệnh trên 1 lần.
|
|
429
|
-
|
|
430
|
-
---
|
|
431
|
-
|
|
432
|
-
## ✅ Checklist Bảo Mật Sau Setup
|
|
433
|
-
|
|
434
|
-
- [ ] `.env` **không** xuất hiện trong `git status`
|
|
435
|
-
- [ ] `.openclaw/credentials/` **không** bị Git track
|
|
436
|
-
- [ ] `openclaw.json` **không** bị Git track
|
|
437
|
-
- [ ] Docker **không** mount nguyên ổ đĩa
|
|
438
|
-
- [ ] Gateway auth token được generate ngẫu nhiên
|
|
439
|
-
- [ ] Zalo Cá nhân: đang dùng tài khoản **phụ** (nếu có)
|
package/docs/ai-providers.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# AI Provider Configuration Guide
|
|
2
|
-
|
|
3
|
-
This guide covers all supported AI providers in OpenClaw. Use it to choose the right provider based on your budget, technical requirements, and privacy needs.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 📊 Provider Comparison
|
|
8
|
-
|
|
9
|
-
| Provider | Cost | API Key Required | Privacy | Best For |
|
|
10
|
-
| --- | --- | --- | --- | --- |
|
|
11
|
-
| **9Router** | 🆓 Free | ❌ OAuth login | Cloud | Beginners. Zero config. Auto-routing. |
|
|
12
|
-
| **Google Gemini** | 🆓 Free tier | ✅ Yes | Cloud | High quality. Generous free limits. |
|
|
13
|
-
| **Anthropic Claude** | 💰 Paid | ✅ Yes | Cloud | Best reasoning & writing quality. |
|
|
14
|
-
| **OpenAI / Codex** | 💰 Paid | ✅ Yes | Cloud | Code generation. Broad ecosystem. |
|
|
15
|
-
| **OpenRouter** | 🆓/💰 Mixed | ✅ Yes | Cloud | Access multiple providers with one key. |
|
|
16
|
-
| **Ollama (Local)** | 🏠 Free | ❌ No key | **Local** | Maximum privacy. Offline capable. |
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 🔀 9Router — Recommended for Beginners
|
|
21
|
-
|
|
22
|
-
9Router is an **open-source AI proxy** that runs on your machine and automatically routes AI requests to the best available free model. Instead of managing API keys, you log in once via OAuth.
|
|
23
|
-
|
|
24
|
-
**Why choose 9Router:**
|
|
25
|
-
- No API key required — authenticate once via OAuth (GitHub, Google, etc.)
|
|
26
|
-
- Auto-routes to free models (iFlow, Qwen, Gemini) with smart fallback
|
|
27
|
-
- Supports 40+ providers and 100+ models
|
|
28
|
-
- Works on **all platforms: Windows, macOS, Linux, VPS**
|
|
29
|
-
- Free forever — open source
|
|
30
|
-
|
|
31
|
-
**Option A — Native install (works on all OS including Windows):**
|
|
32
|
-
```bash
|
|
33
|
-
npm install -g 9router
|
|
34
|
-
9router
|
|
35
|
-
```
|
|
36
|
-
The 9Router dashboard opens at `http://localhost:20128`. Log in and connect a free provider.
|
|
37
|
-
|
|
38
|
-
**Option B — Docker sidecar (automatic when using OpenClaw Docker mode):**
|
|
39
|
-
When you select 9Router in the Setup Wizard and choose Docker mode, the generated `docker-compose.yml` automatically includes 9Router as a sidecar container. No separate installation needed.
|
|
40
|
-
|
|
41
|
-
**Using 9Router with OpenClaw:**
|
|
42
|
-
Whether you installed 9Router natively or via Docker, configure OpenClaw to use it:
|
|
43
|
-
- API endpoint: `http://localhost:20128/v1`
|
|
44
|
-
- API key: copy from the 9Router dashboard
|
|
45
|
-
- Model: select any model showing as available in the dashboard
|
|
46
|
-
|
|
47
|
-
> [!TIP]
|
|
48
|
-
> Start with the free combo: Gemini CLI (180K free/month) + iFlow models (unlimited free) = $0/month cost.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## 🧠 Google Gemini
|
|
53
|
-
|
|
54
|
-
Google Gemini offers the most generous free tier available, making it the best API-key-based option for personal bots.
|
|
55
|
-
|
|
56
|
-
**Available models:** Gemini 2.5 Flash, Gemini 2.5 Pro, Gemini 3.0 Flash
|
|
57
|
-
|
|
58
|
-
**How to get your API key:**
|
|
59
|
-
1. Go to [Google AI Studio](https://aistudio.google.com/apikey)
|
|
60
|
-
2. Sign in with your Google account
|
|
61
|
-
3. Click **Create API Key**
|
|
62
|
-
4. Copy the key into the Setup Wizard when prompted
|
|
63
|
-
|
|
64
|
-
**Free tier limits:** ~15 requests/min, ~1 million tokens/day (as of 2025). Sufficient for personal use.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## 🤖 Anthropic Claude
|
|
69
|
-
|
|
70
|
-
Claude is considered the top-performing model for complex reasoning, long-form content, and instruction-following.
|
|
71
|
-
|
|
72
|
-
**Available models:** Claude Sonnet 4, Claude Opus 4, Claude Haiku 3.5
|
|
73
|
-
|
|
74
|
-
**How to get your API key:**
|
|
75
|
-
1. Go to [Anthropic Console](https://console.anthropic.com/settings/keys)
|
|
76
|
-
2. Create an account and add billing information
|
|
77
|
-
3. Generate an API key and paste it into the Setup Wizard
|
|
78
|
-
|
|
79
|
-
> [!WARNING]
|
|
80
|
-
> Anthropic Claude requires a paid account to obtain an API key. There is no permanent free tier.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 🤖 OpenAI / Codex
|
|
85
|
-
|
|
86
|
-
Best choice if you need GPT-4o for broad tasks or Codex Mini for code-heavy workflows.
|
|
87
|
-
|
|
88
|
-
**Available models:** GPT-4o, GPT-4o Mini, o3, Codex Mini
|
|
89
|
-
|
|
90
|
-
**How to get your API key:**
|
|
91
|
-
1. Go to [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
92
|
-
2. Create an account and add a payment method (minimum $5 credit)
|
|
93
|
-
3. Create an API key and paste it into the Setup Wizard
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 🌐 OpenRouter
|
|
98
|
-
|
|
99
|
-
OpenRouter aggregates hundreds of models (including free ones) under a single API key. Useful if you want to switch between providers without re-running the Setup Wizard.
|
|
100
|
-
|
|
101
|
-
**How to get your API key:**
|
|
102
|
-
1. Go to [OpenRouter.ai](https://openrouter.ai/keys)
|
|
103
|
-
2. Create an account (free)
|
|
104
|
-
3. Generate an API key. Some models on OpenRouter have free usage limits.
|
|
105
|
-
4. Paste the key into the Setup Wizard
|
|
106
|
-
|
|
107
|
-
> [!TIP]
|
|
108
|
-
> OpenRouter includes access to free versions of many open-source models. Check the model list filtered by `Price: Free` on their website.
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## 🏠 Ollama — Local AI (No API Key)
|
|
113
|
-
|
|
114
|
-
Ollama runs AI models directly on your machine or server. No data leaves your infrastructure. Ideal for privacy-sensitive deployments.
|
|
115
|
-
|
|
116
|
-
**Supported local models:** Gemma 4, Llama 3, Qwen 2.5, Phi-3, Mistral, and more.
|
|
117
|
-
|
|
118
|
-
### Docker Mode (Recommended)
|
|
119
|
-
If you run OpenClaw with Docker and select Ollama, the Setup Wizard automatically:
|
|
120
|
-
- Adds an `ollama` sidecar service to your `docker-compose.yml`
|
|
121
|
-
- Configures the internal URL as `http://ollama:11434`
|
|
122
|
-
- Sets `OLLAMA_KEEP_ALIVE=24h` to keep the model in memory
|
|
123
|
-
- Pulls your chosen model on first `docker compose up`
|
|
124
|
-
|
|
125
|
-
You do **not** need to install Ollama separately.
|
|
126
|
-
|
|
127
|
-
### Native Mode
|
|
128
|
-
If running without Docker, you must install Ollama manually:
|
|
129
|
-
1. Go to [ollama.com](https://ollama.com) and download the installer for your OS
|
|
130
|
-
2. After installation, pull your desired model:
|
|
131
|
-
```bash
|
|
132
|
-
ollama pull gemma4
|
|
133
|
-
```
|
|
134
|
-
3. Ensure Ollama is running before starting the bot. OpenClaw will connect to `http://localhost:11434`.
|
|
135
|
-
|
|
136
|
-
### Choosing a Gemma 4 Variant
|
|
137
|
-
See the [Hardware & RAM Guide](hardware-guide.md) for detailed recommendations.
|
|
138
|
-
|
|
139
|
-
| Model | Min RAM | Recommended Use |
|
|
140
|
-
| --- | --- | --- |
|
|
141
|
-
| `gemma4:e2b` | 4 GB | Very lightweight. Budget VPS. |
|
|
142
|
-
| `gemma4:e4b` | 8 GB | Standard laptops and basic VPS. |
|
|
143
|
-
| `gemma4` (Base) | 16 GB | Recommended. Good quality output. |
|
|
144
|
-
| `gemma4:26b` | 32 GB+ | High-end workstations with GPU. |
|