openclaw-plugin-model-fetch 0.2.3 → 0.2.5
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-CN.md +63 -187
- package/README.md +57 -185
- package/dist/contract.d.ts +7 -1
- package/dist/control-ui/bfc77779ea04b85bc02fc16f096d90b1c281194d30a76ce570e7fd2afa6e95d2/index.js +163 -0
- package/dist/model-fetch.js +96 -29
- package/dist/operations.d.ts +3 -2
- package/dist/operations.js +229 -49
- package/dist/schemas.d.ts +22 -1
- package/dist/schemas.js +15 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +1 -1
- package/dist/control-ui/c069f02e4e1108c5f0eac0fd3c5b2810353e159ada13c0e01bfa0cbda80dad7b/index.js +0 -159
- /package/dist/control-ui/{c069f02e4e1108c5f0eac0fd3c5b2810353e159ada13c0e01bfa0cbda80dad7b → bfc77779ea04b85bc02fc16f096d90b1c281194d30a76ce570e7fd2afa6e95d2}/index.css +0 -0
package/README-CN.md
CHANGED
|
@@ -1,244 +1,120 @@
|
|
|
1
1
|
# OpenClaw Model Fetch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](./README.md) | 中文
|
|
4
4
|
|
|
5
5
|
[](https://github.com/AdoShan/OpenClaw-ModelFetch/actions/workflows/ci.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/openclaw-plugin-model-fetch)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
在 OpenClaw Control UI 中获取指定 Provider 的远端模型,按 Provider
|
|
9
|
+
在 OpenClaw Control UI 中获取指定 Provider 的远端模型,按 Provider 筛选,并将确认后的模型写入 OpenClaw 配置,供 WebUI 选用。
|
|
10
10
|
|
|
11
11
|
## 功能
|
|
12
12
|
|
|
13
|
-
- 支持 OpenAI
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- 正则输入框失焦或按 Enter 后更新筛选结果,非法正则会阻止保存和应用。
|
|
18
|
-
- 应用策略前自动重新获取模型并生成删除清单;确认期间列表或配置发生变化时取消写入。
|
|
19
|
-
- 默认使用替换模式,最终配置只保留当前策略选中的远端模型和已手动选择的模型。
|
|
20
|
-
- 自动保护仍被非 Agent 配置引用的模型,例如 utility、决策、媒体、voice、PDF、嵌入式 Agent failover 和 hooks 模型;确认弹窗会列出保留它们的配置路径。
|
|
21
|
-
- 已有模型 ID 会保留原有的名称、价格、模态等扩展字段,不暴露 Provider API Key。
|
|
22
|
-
- 选择“覆盖 Agent”后,应用策略会同步该 Agent 的 allowlist 与模型映射:新增本次选中的模型,并移除该 Provider 下已取消选择的精确条目,避免 WebUI 继续显示过期模型。
|
|
13
|
+
- 支持 OpenAI 兼容、Anthropic 兼容、Ollama 和 OpenRouter Provider。
|
|
14
|
+
- 为每个 Provider 独立保存包含正则、排除正则和手动白名单策略。
|
|
15
|
+
- 将获取模型与应用配置分开,并在写入前显示所有待删除模型。
|
|
16
|
+
- 保护仍被其他 OpenClaw 配置引用的模型,并可同步 Agent 模型 allowlist。
|
|
23
17
|
|
|
24
18
|
## 环境要求
|
|
25
19
|
|
|
26
20
|
- Node.js 24.16 或更新版本
|
|
27
21
|
- OpenClaw `2026.10.5` 或更新版本
|
|
28
|
-
-
|
|
22
|
+
- 已配置至少一个具有有效 `baseUrl` 及所需认证信息的 `models.providers.<providerId>`
|
|
29
23
|
|
|
30
|
-
##
|
|
24
|
+
## 快速开始
|
|
31
25
|
|
|
32
|
-
|
|
26
|
+
### 1. 安装
|
|
33
27
|
|
|
34
28
|
```bash
|
|
35
|
-
|
|
36
|
-
npm run plugin:build
|
|
37
|
-
npm run plugin:validate
|
|
29
|
+
openclaw plugins install openclaw-plugin-model-fetch
|
|
38
30
|
```
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
### 2. 开启设置界面
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
openclaw plugins install /absolute/path/to/OpenClaw-ModelFetch
|
|
44
|
-
```
|
|
34
|
+
自定义插件 UI 默认关闭。打开与 Gateway 同源的 Control UI,然后开启:
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
**Settings -> Labs -> Custom plugin UI**
|
|
37
|
+
|
|
38
|
+
也可以直接使用 OpenClaw CLI 开启:
|
|
47
39
|
|
|
48
40
|
```bash
|
|
49
|
-
openclaw
|
|
50
|
-
npm run plugin:build
|
|
41
|
+
openclaw config set gateway.controlUi.experimental.customPlugins true --strict-json
|
|
51
42
|
```
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
刷新浏览器页面后,Control UI 侧边栏会出现 **Model Fetch**。
|
|
45
|
+
|
|
46
|
+
### 3. 检查安装
|
|
54
47
|
|
|
55
48
|
```bash
|
|
56
49
|
openclaw plugins list
|
|
57
50
|
openclaw plugins doctor
|
|
58
51
|
```
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
插件应处于启用、已加载状态,并且没有配置错误。
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
## 使用
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
1. 打开 **Model Fetch**,选择目标 Provider。
|
|
58
|
+
2. 点击 **获取远端模型**。该操作只读取远端模型列表。
|
|
59
|
+
3. 设置包含正则、排除正则,或勾选模型加入手动白名单。
|
|
60
|
+
4. 选择需要同步模型 allowlist 的 Agent。
|
|
61
|
+
5. 点击 **保存策略**。
|
|
62
|
+
6. 点击 **应用策略到配置**。
|
|
63
|
+
7. 出现删除确认弹窗时逐项检查。确认前不会写入任何模型配置。
|
|
64
|
+
8. 打开 OpenClaw 的 Models 页面,选用新写入的模型。
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
设置界面会跟随 OpenClaw WebUI 的语言显示:中文区域使用中文,其他区域默认使用英文。
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
2. Custom plugin UI 已开启。
|
|
70
|
-
3. 已经运行 `npm run plugin:build`,并刷新 Control UI。
|
|
71
|
-
4. Control UI 与 Gateway 同源,且使用 HTTPS 或浏览器可信的 loopback 地址。
|
|
68
|
+
### 各操作的影响
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
| 操作 | 修改插件策略 | 修改 Provider 模型 | 需要删除确认 |
|
|
71
|
+
| --- | --- | --- | --- |
|
|
72
|
+
| 获取远端模型 | 否 | 否 | 否 |
|
|
73
|
+
| 保存策略 | 是 | 否 | 否 |
|
|
74
|
+
| 应用策略到配置 | 否 | 是 | 仅在会删除模型时 |
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
gateway: {
|
|
78
|
-
controlUi: {
|
|
79
|
-
experimental: {
|
|
80
|
-
customPlugins: true,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
}
|
|
85
|
-
```
|
|
76
|
+
默认使用替换模式。应用策略时,未选中的已有 Provider 模型会被删除;仍被其他 OpenClaw 配置引用的模型会受到保护。
|
|
86
77
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### 常见问题:安装后看不到 Model Fetch 设置页
|
|
90
|
-
|
|
91
|
-
可按以下顺序排查:
|
|
92
|
-
|
|
93
|
-
1. 确认插件已安装并启用:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
openclaw plugins list
|
|
97
|
-
openclaw plugins doctor
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
2. 确认已经重新构建并让 Gateway 读取到最新 `openclaw.plugin.json`:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
npm run plugin:build
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
3. 重启 Gateway 或刷新 Control UI 页面,再进入:
|
|
107
|
-
|
|
108
|
-
- 设置页入口:`/settings/plugins/model-fetch?view=settings`
|
|
109
|
-
- 插件页面入口:`/plugin?plugin=model-fetch&id=model-fetch`
|
|
110
|
-
|
|
111
|
-
4. 若页面可打开但无功能,请检查浏览器控制台是否有报错,并优先确认插件 session action 返回值是 JSON 兼容对象(本插件当前实现已按 JSON 兼容返回)。
|
|
112
|
-
|
|
113
|
-
## 使用流程
|
|
114
|
-
|
|
115
|
-
1. 打开 **Model Fetch**,在当前 Provider 下拉框中选择目标 Provider。
|
|
116
|
-
2. 点击 **获取远端模型**。这一步只读取远端模型列表,不写入配置。
|
|
117
|
-
3. 设置包含正则、排除正则,或勾选白名单模型。勾选只会把模型加入白名单,不会立即修改 OpenClaw 配置。
|
|
118
|
-
4. 在“覆盖 Agent”里勾选要同步 allowlist 的 agent(仅对已配置 modelPolicy.allow 的 agent 生效)。
|
|
119
|
-
5. 点击 **保存策略**,保存当前 Provider 的独立筛选配置与目标 agent。
|
|
120
|
-
6. 点击 **应用策略到配置**。插件会重新获取远端模型并检查配置。
|
|
121
|
-
7. 如果这次操作会删除已有模型,确认弹窗会逐项列出即将删除的模型。确认后才会写入。
|
|
122
|
-
8. 回到 OpenClaw 的 Models 页面,即可选用新写入的模型。
|
|
123
|
-
|
|
124
|
-
如果你启用了模型策略 allowlist(`agents.defaults.modelPolicy.allow` 或 `agents.entries.<agent>.modelPolicy.allow` 非空),插件在应用策略时会同步本次写入的 `provider/model`。对“覆盖 Agent”中选中的 Agent,同步会移除该 Provider 下已取消选择的精确模型条目;其他 Provider、通配规则(如 `provider/*`)和保留模型的自定义 Agent 配置不会被删除。
|
|
125
|
-
|
|
126
|
-
应用默认采用替换模式:当前 Provider 中未被策略选中的模型会被删除。如果模型仍被非 Agent 消费方引用,例如 `agents.defaults.utilityModel`、`agents.defaults.imageModel`、`agents.defaults.mediaModels.*`、`agents.defaults.voiceModel`、`agents.defaults.pdfModel`、`agents.defaults.embeddedAgent.cyberFailover.model`、`agents.entries.*.utilityModel`、`agents.entries.*.decisionModel`、`hooks.gmail.model` 或 `hooks.mappings[].model`,该模型会被保留,确认弹窗会列出这些引用。若预览后远端列表、筛选策略、引用保护集合或其他配置发生变化,本次写入会中止并要求重新预览。
|
|
127
|
-
|
|
128
|
-
## 筛选规则
|
|
129
|
-
|
|
130
|
-
- `includeRegex`:仅选择模型 ID 匹配该 JavaScript 正则的模型。留空时不按正则限制。
|
|
131
|
-
- `excludeRegex`:从正则选择结果中排除匹配的模型。
|
|
132
|
-
- `manualIds`:精确手动白名单。存在白名单且 `includeRegex` 为空时,只选择白名单模型。
|
|
133
|
-
- 手动白名单优先:白名单中的模型即使匹配排除正则,仍会被选择。
|
|
134
|
-
- 手动白名单中的模型如果仍存在于配置中,会继续保留,即使远端这次没有返回它。
|
|
135
|
-
- `replace`:插件默认使用 `true`。设置界面始终按替换模式运行;Agent 工具调用可显式传入 `false`,只增加模型而不删除旧模型。
|
|
136
|
-
- 非法正则不会被保存或应用。
|
|
137
|
-
|
|
138
|
-
Provider 策略保存在插件配置中:
|
|
139
|
-
|
|
140
|
-
```json
|
|
141
|
-
{
|
|
142
|
-
"plugins": {
|
|
143
|
-
"entries": {
|
|
144
|
-
"model-fetch": {
|
|
145
|
-
"config": {
|
|
146
|
-
"providers": {
|
|
147
|
-
"openrouter": {
|
|
148
|
-
"filter": {
|
|
149
|
-
"includeRegex": "^(openai|anthropic)/",
|
|
150
|
-
"excludeRegex": "(embed|rerank)",
|
|
151
|
-
"manualIds": ["openai/gpt-4o-mini"],
|
|
152
|
-
"replace": true
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
"ollama": {
|
|
156
|
-
"filter": {
|
|
157
|
-
"manualIds": ["qwen3:latest", "llama3.1:8b"],
|
|
158
|
-
"replace": true
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
78
|
+
筛选规则、引用保护、Agent 同步、`model_fetch` 工具和 Provider 示例请阅读 [配置参考](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/zh-CN/configuration.md)。
|
|
168
79
|
|
|
169
|
-
##
|
|
80
|
+
## 故障排查
|
|
170
81
|
|
|
171
|
-
|
|
82
|
+
### 没有显示或启用 Model Fetch
|
|
172
83
|
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
"provider": "openrouter"
|
|
176
|
-
}
|
|
177
|
-
```
|
|
84
|
+
运行 `openclaw plugins list` 和 `openclaw plugins doctor`。如果插件缺失或被判定为包损坏,请重新安装。
|
|
178
85
|
|
|
179
|
-
|
|
86
|
+
### 侧边栏没有 Model Fetch 入口
|
|
180
87
|
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
"provider": "openrouter",
|
|
184
|
-
"includeRegex": "anthropic/",
|
|
185
|
-
"dryRun": true
|
|
186
|
-
}
|
|
187
|
-
```
|
|
88
|
+
确认已开启 **Settings -> Labs -> Custom plugin UI**,然后刷新 Control UI。设置页直达地址是 `/settings/plugins/model-fetch?view=settings`。
|
|
188
89
|
|
|
189
|
-
|
|
90
|
+
### 获取远端模型失败
|
|
190
91
|
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
"provider": "ollama",
|
|
194
|
-
"manualIds": ["qwen3:latest", "llama3.1:8b"]
|
|
195
|
-
}
|
|
196
|
-
```
|
|
92
|
+
确认 Provider 的 `baseUrl`、`api` 和认证信息在 OpenClaw 中可以正常工作。Ollama 等本机或私有网络地址需要启用 `request.allowPrivateNetwork: true`。
|
|
197
93
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
## Provider 示例
|
|
201
|
-
|
|
202
|
-
```json
|
|
203
|
-
{
|
|
204
|
-
"models": {
|
|
205
|
-
"providers": {
|
|
206
|
-
"openrouter": {
|
|
207
|
-
"baseUrl": "https://openrouter.ai/api/v1",
|
|
208
|
-
"api": "openai-responses",
|
|
209
|
-
"models": []
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
94
|
+
### 应用后仍能看到旧模型
|
|
215
95
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"request": {
|
|
226
|
-
"allowPrivateNetwork": true
|
|
227
|
-
},
|
|
228
|
-
"models": []
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
96
|
+
确认应用操作已经完成,并检查相关 Agent 是否已选择同步。部分模型可能因引用保护而被有意保留。请检查应用结果后刷新 Models 页面或受影响的会话。
|
|
97
|
+
|
|
98
|
+
## 文档与反馈
|
|
99
|
+
|
|
100
|
+
- [配置参考](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/zh-CN/configuration.md)
|
|
101
|
+
- [English configuration reference](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/en/configuration.md)
|
|
102
|
+
- [问题反馈](https://github.com/AdoShan/OpenClaw-ModelFetch/issues)
|
|
103
|
+
- [版本发布](https://github.com/AdoShan/OpenClaw-ModelFetch/releases)
|
|
104
|
+
- [npm 包](https://www.npmjs.com/package/openclaw-plugin-model-fetch)
|
|
234
105
|
|
|
235
106
|
## 开发
|
|
236
107
|
|
|
108
|
+
在源码仓库中运行:
|
|
109
|
+
|
|
237
110
|
```bash
|
|
111
|
+
npm ci
|
|
238
112
|
npm test
|
|
239
|
-
npm run typecheck
|
|
240
|
-
npm run plugin:build
|
|
241
113
|
npm run plugin:validate
|
|
242
114
|
```
|
|
243
115
|
|
|
244
|
-
|
|
116
|
+
`plugin:validate` 会构建并校验插件。需要直接使用源码目录时,可运行 `openclaw plugins install /absolute/path/to/OpenClaw-ModelFetch --link`。源码修改后需要重新构建并重新加载插件。
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,247 +1,119 @@
|
|
|
1
1
|
# OpenClaw Model Fetch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [中文](./README-CN.md)
|
|
4
4
|
|
|
5
5
|
[](https://github.com/AdoShan/OpenClaw-ModelFetch/actions/workflows/ci.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/openclaw-plugin-model-fetch)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
Fetch a provider's remote model list
|
|
9
|
+
Fetch a provider's remote model list in the OpenClaw Control UI, filter it per provider, and write the confirmed models into OpenClaw configuration for the WebUI to use.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- Refreshes results on blur or Enter; invalid regexes block saving and applying.
|
|
18
|
-
- Re-fetches and re-plans before applying, and aborts the write if the remote list or config changed during confirmation.
|
|
19
|
-
- Defaults to replace mode: the final config keeps only the models selected by the current strategy plus manually selected ones.
|
|
20
|
-
- Protects models still referenced by non-agent settings such as utility, decision, media, voice, PDF, embedded-agent failover and hook models; the delete dialog lists the config paths that kept them.
|
|
21
|
-
- Preserves existing per-model fields (name, cost, modalities and so on) for known IDs, and never exposes provider API keys.
|
|
22
|
-
- When "override agent" is selected, applying also syncs that agent's allowlist and model map: newly selected models are added and deselected exact entries for the same provider are removed, so the WebUI stops offering stale models.
|
|
13
|
+
- Fetches models from OpenAI-compatible, Anthropic-compatible, Ollama, and OpenRouter providers.
|
|
14
|
+
- Saves independent include regex, exclude regex, and manual whitelist strategies for each provider.
|
|
15
|
+
- Separates remote fetching from configuration writes and shows every model deletion before applying.
|
|
16
|
+
- Preserves models referenced by other OpenClaw settings and can synchronize Agent model allowlists.
|
|
23
17
|
|
|
24
18
|
## Requirements
|
|
25
19
|
|
|
26
20
|
- Node.js 24.16 or newer
|
|
27
21
|
- OpenClaw `2026.10.5` or newer
|
|
28
|
-
- At least one configured `models.providers.<providerId>` with
|
|
22
|
+
- At least one configured `models.providers.<providerId>` with a valid `baseUrl` and any authentication required by the provider
|
|
29
23
|
|
|
30
|
-
##
|
|
24
|
+
## Quick Start
|
|
31
25
|
|
|
32
|
-
|
|
26
|
+
### 1. Install
|
|
33
27
|
|
|
34
28
|
```bash
|
|
35
|
-
|
|
36
|
-
npm run plugin:build
|
|
37
|
-
npm run plugin:validate
|
|
29
|
+
openclaw plugins install openclaw-plugin-model-fetch
|
|
38
30
|
```
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
### 2. Enable the settings UI
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
openclaw plugins install /absolute/path/to/OpenClaw-ModelFetch
|
|
44
|
-
```
|
|
34
|
+
Custom plugin UIs are disabled by default. Open the Control UI from the same origin as the Gateway, then enable:
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
**Settings -> Labs -> Custom plugin UI**
|
|
37
|
+
|
|
38
|
+
Alternatively, enable it directly with the OpenClaw CLI:
|
|
47
39
|
|
|
48
40
|
```bash
|
|
49
|
-
openclaw
|
|
50
|
-
npm run plugin:build
|
|
41
|
+
openclaw config set gateway.controlUi.experimental.customPlugins true --strict-json
|
|
51
42
|
```
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
Reload the browser page. **Model Fetch** should now appear in the Control UI sidebar.
|
|
45
|
+
|
|
46
|
+
### 3. Verify the installation
|
|
54
47
|
|
|
55
48
|
```bash
|
|
56
49
|
openclaw plugins list
|
|
57
50
|
openclaw plugins doctor
|
|
58
51
|
```
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Custom plugin UIs are disabled by default. Open the Control UI served from the same origin as the Gateway, then go to:
|
|
63
|
-
|
|
64
|
-
**Settings → Labs → Custom plugin UI**
|
|
65
|
-
|
|
66
|
-
Enable it and reload the browser page. **Model Fetch** then appears in the Control UI sidebar. If you installed a local plugin but the entry is missing, check in order:
|
|
67
|
-
|
|
68
|
-
1. `openclaw plugins list` shows the plugin enabled with no configuration errors.
|
|
69
|
-
2. Custom plugin UI is enabled.
|
|
70
|
-
3. `npm run plugin:build` has been run and the Control UI reloaded.
|
|
71
|
-
4. The Control UI shares the Gateway origin and is served over HTTPS or a browser-trusted loopback address.
|
|
72
|
-
|
|
73
|
-
The equivalent config entry is:
|
|
74
|
-
|
|
75
|
-
```json5
|
|
76
|
-
{
|
|
77
|
-
gateway: {
|
|
78
|
-
controlUi: {
|
|
79
|
-
experimental: {
|
|
80
|
-
customPlugins: true,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The plugin does not draw OpenClaw's application sidebar itself; pages and navigation are managed by the Control UI host.
|
|
88
|
-
|
|
89
|
-
### Troubleshooting: the Model Fetch settings page is missing
|
|
90
|
-
|
|
91
|
-
Work through these in order:
|
|
53
|
+
The plugin should be enabled, loaded, and free of configuration errors.
|
|
92
54
|
|
|
93
|
-
|
|
55
|
+
## Usage
|
|
94
56
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
57
|
+
1. Open **Model Fetch** and select the target provider.
|
|
58
|
+
2. Click **Fetch remote models**. This only reads the remote model list.
|
|
59
|
+
3. Set the include and exclude regexes, or tick models to add them to the manual whitelist.
|
|
60
|
+
4. Select any Agents whose model allowlists should be synchronized.
|
|
61
|
+
5. Click **Save strategy**.
|
|
62
|
+
6. Click **Apply strategy to config**.
|
|
63
|
+
7. Review the deletion dialog when shown. No model configuration is written until you confirm.
|
|
64
|
+
8. Open the OpenClaw Models page and select the newly available models.
|
|
99
65
|
|
|
100
|
-
|
|
66
|
+
The settings interface follows the OpenClaw WebUI language: Chinese locales use Chinese, and other locales default to English.
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
npm run plugin:build
|
|
104
|
-
```
|
|
68
|
+
### What each action changes
|
|
105
69
|
|
|
106
|
-
|
|
70
|
+
| Action | Changes plugin strategy | Changes provider models | Requires deletion confirmation |
|
|
71
|
+
| --- | --- | --- | --- |
|
|
72
|
+
| Fetch remote models | No | No | No |
|
|
73
|
+
| Save strategy | Yes | No | No |
|
|
74
|
+
| Apply strategy to config | No | Yes | Only when models will be deleted |
|
|
107
75
|
|
|
108
|
-
|
|
109
|
-
- Plugin page: `/plugin?plugin=model-fetch&id=model-fetch`
|
|
76
|
+
Replacement mode is the default. Applying a strategy removes existing provider models that are not selected, except models protected by other OpenClaw configuration references.
|
|
110
77
|
|
|
111
|
-
|
|
78
|
+
See the [configuration reference](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/en/configuration.md) for filter rules, protected references, Agent synchronization, the `model_fetch` tool, and provider examples.
|
|
112
79
|
|
|
113
|
-
##
|
|
80
|
+
## Troubleshooting
|
|
114
81
|
|
|
115
|
-
|
|
116
|
-
2. Click **Fetch remote models**. This only reads the remote model list and never writes config.
|
|
117
|
-
3. Set the include regex and exclude regex, or tick allowlist models. Ticking only adds to the allowlist and does not modify OpenClaw config.
|
|
118
|
-
4. Under **Override agent**, tick the agents whose allowlist should be synced (only affects agents that already have `modelPolicy.allow` configured).
|
|
119
|
-
5. Click **Save strategy** to persist the per-provider filter and target agents.
|
|
120
|
-
6. Click **Apply strategy to config**. The plugin re-fetches remote models and re-checks the config.
|
|
121
|
-
7. If the operation would delete existing models, the confirmation dialog lists each one. Nothing is written until you confirm.
|
|
122
|
-
8. Return to the OpenClaw Models page and the newly written models are available.
|
|
123
|
-
|
|
124
|
-
If you use model policy allowlists (`agents.defaults.modelPolicy.allow` or a non-empty `agents.entries.<agent>.modelPolicy.allow`), applying the strategy also syncs the `provider/model` entries written in this run. For agents ticked under "Override agent", the sync removes deselected exact model entries for that provider; other providers, wildcard rules such as `provider/*`, and custom agent configs for retained models are left alone.
|
|
125
|
-
|
|
126
|
-
Applying uses replace mode by default: models for the current provider that the strategy did not select are removed. A model is kept when it is still referenced by a non-agent consumer such as `agents.defaults.utilityModel`, `agents.defaults.imageModel`, `agents.defaults.mediaModels.*`, `agents.defaults.voiceModel`, `agents.defaults.pdfModel`, `agents.defaults.embeddedAgent.cyberFailover.model`, `agents.entries.*.utilityModel`, `agents.entries.*.decisionModel`, `hooks.gmail.model` or `hooks.mappings[].model`. The confirmation dialog lists those references. If the remote list, filter strategy, protected references or other config changes after the preview, the write is aborted and a fresh preview is required.
|
|
127
|
-
|
|
128
|
-
## Filter rules
|
|
129
|
-
|
|
130
|
-
- `includeRegex`: select only model IDs matching this JavaScript regex. Empty means no regex restriction.
|
|
131
|
-
- `excludeRegex`: remove matching models from the regex-selected set.
|
|
132
|
-
- `manualIds`: exact manual allowlist. With an allowlist and no `includeRegex`, only allowlisted models are selected.
|
|
133
|
-
- Manual allowlist wins: allowlisted models are selected even if they match the exclude regex.
|
|
134
|
-
- Allowlisted models already present in config are retained even if the remote list no longer returns them.
|
|
135
|
-
- `replace`: the plugin defaults to `true`. The settings UI always runs in replace mode; agent tool calls may pass `false` to add models without removing old ones.
|
|
136
|
-
- Invalid regexes are neither saved nor applied.
|
|
137
|
-
|
|
138
|
-
Provider strategies are stored in the plugin config:
|
|
139
|
-
|
|
140
|
-
```json
|
|
141
|
-
{
|
|
142
|
-
"plugins": {
|
|
143
|
-
"entries": {
|
|
144
|
-
"model-fetch": {
|
|
145
|
-
"config": {
|
|
146
|
-
"providers": {
|
|
147
|
-
"openrouter": {
|
|
148
|
-
"filter": {
|
|
149
|
-
"includeRegex": "^(openai|anthropic)/",
|
|
150
|
-
"excludeRegex": "(embed|rerank)",
|
|
151
|
-
"manualIds": ["openai/gpt-4o-mini"],
|
|
152
|
-
"replace": true
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
"ollama": {
|
|
156
|
-
"filter": {
|
|
157
|
-
"manualIds": ["qwen3:latest", "llama3.1:8b"],
|
|
158
|
-
"replace": true
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
82
|
+
### Model Fetch is not listed or enabled
|
|
168
83
|
|
|
169
|
-
|
|
84
|
+
Run `openclaw plugins list` and `openclaw plugins doctor`. Reinstall the package if it is missing or reported as broken.
|
|
170
85
|
|
|
171
|
-
The
|
|
86
|
+
### The Model Fetch navigation entry is missing
|
|
172
87
|
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
"provider": "openrouter"
|
|
176
|
-
}
|
|
177
|
-
```
|
|
88
|
+
Confirm that **Settings -> Labs -> Custom plugin UI** is enabled, then reload the Control UI. The direct settings route is `/settings/plugins/model-fetch?view=settings`.
|
|
178
89
|
|
|
179
|
-
|
|
90
|
+
### Fetching remote models fails
|
|
180
91
|
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
"provider": "openrouter",
|
|
184
|
-
"includeRegex": "anthropic/",
|
|
185
|
-
"dryRun": true
|
|
186
|
-
}
|
|
187
|
-
```
|
|
92
|
+
Confirm that the provider's `baseUrl`, `api`, and authentication work in OpenClaw. Local or private-network endpoints such as Ollama require `request.allowPrivateNetwork: true`.
|
|
188
93
|
|
|
189
|
-
|
|
94
|
+
### Old models are still visible after applying
|
|
190
95
|
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
"provider": "ollama",
|
|
194
|
-
"manualIds": ["qwen3:latest", "llama3.1:8b"]
|
|
195
|
-
}
|
|
196
|
-
```
|
|
96
|
+
Confirm that the apply operation completed and that the relevant Agents were selected for synchronization. Some models can remain intentionally because of reference protection. Reload the Models page or the affected session after checking the apply result.
|
|
197
97
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
## Provider examples
|
|
201
|
-
|
|
202
|
-
```json
|
|
203
|
-
{
|
|
204
|
-
"models": {
|
|
205
|
-
"providers": {
|
|
206
|
-
"openrouter": {
|
|
207
|
-
"baseUrl": "https://openrouter.ai/api/v1",
|
|
208
|
-
"api": "openai-responses",
|
|
209
|
-
"models": []
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
98
|
+
## Documentation and Support
|
|
215
99
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"providers": {
|
|
222
|
-
"ollama": {
|
|
223
|
-
"baseUrl": "http://127.0.0.1:11434",
|
|
224
|
-
"api": "ollama",
|
|
225
|
-
"request": {
|
|
226
|
-
"allowPrivateNetwork": true
|
|
227
|
-
},
|
|
228
|
-
"models": []
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
100
|
+
- [Configuration reference](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/en/configuration.md)
|
|
101
|
+
- [中文配置参考](https://github.com/AdoShan/OpenClaw-ModelFetch/blob/main/docs/zh-CN/configuration.md)
|
|
102
|
+
- [Report an issue](https://github.com/AdoShan/OpenClaw-ModelFetch/issues)
|
|
103
|
+
- [Releases](https://github.com/AdoShan/OpenClaw-ModelFetch/releases)
|
|
104
|
+
- [npm package](https://www.npmjs.com/package/openclaw-plugin-model-fetch)
|
|
234
105
|
|
|
235
106
|
## Development
|
|
236
107
|
|
|
108
|
+
For a source checkout, run:
|
|
109
|
+
|
|
237
110
|
```bash
|
|
111
|
+
npm ci
|
|
238
112
|
npm test
|
|
239
|
-
npm run typecheck
|
|
240
|
-
npm run plugin:build
|
|
241
113
|
npm run plugin:validate
|
|
242
114
|
```
|
|
243
115
|
|
|
244
|
-
|
|
116
|
+
`plugin:validate` builds and validates the plugin. To use the checkout directly, install it with `openclaw plugins install /absolute/path/to/OpenClaw-ModelFetch --link`. Rebuild and reload the plugin after source changes.
|
|
245
117
|
|
|
246
118
|
## License
|
|
247
119
|
|
package/dist/contract.d.ts
CHANGED
|
@@ -94,6 +94,11 @@ export declare const modelFetchContract: {
|
|
|
94
94
|
}>>;
|
|
95
95
|
selectedIds: import("typebox").TArray<import("typebox").TString>;
|
|
96
96
|
unchangedCount: import("typebox").TInteger;
|
|
97
|
+
affectedSessions: import("typebox").TArray<import("typebox").TObject<{
|
|
98
|
+
sessionKey: import("typebox").TString;
|
|
99
|
+
agentId: import("typebox").TString;
|
|
100
|
+
label: import("typebox").TString;
|
|
101
|
+
}>>;
|
|
97
102
|
}>;
|
|
98
103
|
models: import("typebox").TArray<import("typebox").TObject<{
|
|
99
104
|
id: import("typebox").TString;
|
|
@@ -128,7 +133,8 @@ export declare const modelFetchContract: {
|
|
|
128
133
|
}>>;
|
|
129
134
|
targetAgents: import("typebox").TArray<import("typebox").TString>;
|
|
130
135
|
syncedAgents: import("typebox").TArray<import("typebox").TString>;
|
|
131
|
-
|
|
136
|
+
sessionSelectionResets: import("typebox").TInteger;
|
|
137
|
+
resetSessionKeys: import("typebox").TArray<import("typebox").TString>;
|
|
132
138
|
models: import("typebox").TArray<import("typebox").TObject<{
|
|
133
139
|
id: import("typebox").TString;
|
|
134
140
|
name: import("typebox").TString;
|