@maplezzk/llm-proxy 0.27.0 → 0.28.1
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 +24 -4
- package/README.zh.md +24 -4
- package/dist/api/admin-ui.html +53 -53
- package/dist/api/handlers/admin-handoff.d.ts +19 -0
- package/dist/api/handlers/admin-handoff.d.ts.map +1 -0
- package/dist/api/handlers/admin-handoff.js +81 -0
- package/dist/api/handlers/admin-handoff.js.map +1 -0
- package/dist/api/handlers/index.d.ts +1 -0
- package/dist/api/handlers/index.d.ts.map +1 -1
- package/dist/api/handlers/index.js +1 -0
- package/dist/api/handlers/index.js.map +1 -1
- package/dist/api/server.d.ts +2 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +16 -4
- package/dist/api/server.js.map +1 -1
- package/dist/types/i18n.generated.d.ts +1 -1
- package/dist/types/i18n.generated.d.ts.map +1 -1
- package/locales/en/translation.json +8 -1
- package/locales/zh/translation.json +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ The admin UI supports:
|
|
|
78
78
|
- **Provider management**: Add/edit/delete AI providers, pull model lists from APIs, declare input modalities (text/image)
|
|
79
79
|
- **Adapter config**: Create virtual endpoints with model remapping and protocol adaptation
|
|
80
80
|
- **Vision settings**: Enable external vision (image-to-text) for non-multimodal models, view cache stats
|
|
81
|
-
- **Management key**: Store an independent admin API key
|
|
81
|
+
- **Management key**: Store an independent admin API key scoped to the current service for protected management endpoints
|
|
82
82
|
- **Proxy key**: Set API authentication key
|
|
83
83
|
- **Live test**: Send test requests directly to verify configuration
|
|
84
84
|
- **Protocol capture**: Real-time request/response inspection
|
|
@@ -192,8 +192,10 @@ llm-proxy status # Show status
|
|
|
192
192
|
| `/admin/logs/stats` | GET | Log statistics |
|
|
193
193
|
| `/admin/token-stats` | GET | Token usage stats |
|
|
194
194
|
| `/admin/log-level` | GET / PUT | Read / update log level |
|
|
195
|
-
| `/admin/locale` | GET / PUT | Read / update
|
|
196
|
-
| `/admin/port` | GET / PUT | Read / update listening port
|
|
195
|
+
| `/admin/locale` | GET / PUT | Read / update server message locale (zh / en) |
|
|
196
|
+
| `/admin/port` | GET / PUT | Read / update the listening port with runtime rebinding |
|
|
197
|
+
| `/admin/auth/handoff` | POST | Issue a one-time Web UI handoff code using the current management key |
|
|
198
|
+
| `/admin/auth/handoff/exchange` | POST | Exchange a one-time Web UI handoff code |
|
|
197
199
|
| `/admin/proxy-key` | GET / PUT | Read / update proxy auth key |
|
|
198
200
|
| `/admin/vision` | GET / PUT | Read / update external-vision config |
|
|
199
201
|
| `/admin/vision-cache/stats` | GET | Vision cache hit / miss / size |
|
|
@@ -205,7 +207,25 @@ llm-proxy status # Show status
|
|
|
205
207
|
| `/admin/test-adapter` | POST | Send a test request through an adapter |
|
|
206
208
|
| `/admin/debug/captures/*` | GET / POST | Protocol capture ring buffer + SSE stream |
|
|
207
209
|
|
|
208
|
-
When `admin_key` is configured,
|
|
210
|
+
When `admin_key` is configured, management APIs require `Authorization: Bearer <key>` or `x-api-key: <key>`, except for the static `GET /admin` shell and the one-time handoff exchange endpoint. Web UI credentials are scoped by origin and reverse-proxy path. When the macOS App opens the Web UI over HTTPS or loopback HTTP, it can import the key through a 60-second, single-use handoff code; the raw key is never placed in the URL. To rotate or remove the key with hot reload, authenticate with the currently running key: `llm-proxy reload --admin-key <current-key>` (or set `LLM_PROXY_ADMIN_KEY`).
|
|
211
|
+
|
|
212
|
+
The macOS App and Web UI keep their interface language preferences locally and no longer modify the server `locale`. The server locale controls server logs and backend messages only.
|
|
213
|
+
|
|
214
|
+
### Reverse-proxy paths
|
|
215
|
+
|
|
216
|
+
The Web UI derives its reverse-proxy prefix from the current `/admin` page URL. For example, publishing the service below `/llm-proxy/` only requires ordinary Nginx path forwarding:
|
|
217
|
+
|
|
218
|
+
```nginx
|
|
219
|
+
location /llm-proxy/ {
|
|
220
|
+
proxy_pass http://127.0.0.1:9000/;
|
|
221
|
+
proxy_set_header Host $host;
|
|
222
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
223
|
+
proxy_set_header Authorization $http_authorization;
|
|
224
|
+
proxy_buffering off;
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Do not use `sub_filter` to globally replace `/admin`. It also rewrites regular expressions inside the inline JavaScript bundle and causes a syntax error before the Web UI can start.
|
|
209
229
|
|
|
210
230
|
## Protocol Translation Matrix
|
|
211
231
|
|
package/README.zh.md
CHANGED
|
@@ -78,7 +78,7 @@ llm-proxy start
|
|
|
78
78
|
- **Provider 管理**:增删改 AI 服务商、拉取远程模型列表、声明输入模态(文本/图片)
|
|
79
79
|
- **适配器配置**:创建带模型重映射和协议转换的虚拟端点
|
|
80
80
|
- **识图设置**:为不支持图片的模型启用外挂识图、查看缓存命中率
|
|
81
|
-
-
|
|
81
|
+
- **管理密钥**:按当前服务地址保存独立的管理 API 密钥,用于访问受保护的管理接口
|
|
82
82
|
- **代理密钥**:设置 API 认证密钥
|
|
83
83
|
- **连通性测试**:直接发送测试请求验证配置
|
|
84
84
|
- **协议抓包**:实时查看请求/响应原文
|
|
@@ -178,8 +178,10 @@ llm-proxy status # 查看状态
|
|
|
178
178
|
| `/admin/logs/stats` | GET | 日志统计 |
|
|
179
179
|
| `/admin/token-stats` | GET | Token 统计 |
|
|
180
180
|
| `/admin/log-level` | GET / PUT | 查看 / 修改日志级别 |
|
|
181
|
-
| `/admin/locale` | GET / PUT | 查看 /
|
|
182
|
-
| `/admin/port` | GET / PUT | 查看 /
|
|
181
|
+
| `/admin/locale` | GET / PUT | 查看 / 修改服务端消息语言(zh / en) |
|
|
182
|
+
| `/admin/port` | GET / PUT | 查看 / 修改监听端口(运行时热切换) |
|
|
183
|
+
| `/admin/auth/handoff` | POST | 使用当前管理密钥签发一次性 Web UI 交接码 |
|
|
184
|
+
| `/admin/auth/handoff/exchange` | POST | Web UI 兑换一次性交接码 |
|
|
183
185
|
| `/admin/proxy-key` | GET / PUT | 查看 / 修改代理认证密钥 |
|
|
184
186
|
| `/admin/vision` | GET / PUT | 查看 / 修改外挂识图配置 |
|
|
185
187
|
| `/admin/vision-cache/stats` | GET | 识图缓存命中率 / 容量 |
|
|
@@ -191,7 +193,25 @@ llm-proxy status # 查看状态
|
|
|
191
193
|
| `/admin/test-adapter` | POST | 通过适配器发送测试请求 |
|
|
192
194
|
| `/admin/debug/captures/*` | GET / POST | 协议抓包环形缓冲 + SSE 推送 |
|
|
193
195
|
|
|
194
|
-
配置 `admin_key`
|
|
196
|
+
配置 `admin_key` 后,除静态 `GET /admin` 页面外壳和一次性交接码兑换接口外,管理 API 都必须携带 `Authorization: Bearer <key>` 或 `x-api-key: <key>`。Web UI 会按 origin 和反向代理路径隔离密钥;macOS App 通过 HTTPS 或本机 HTTP 打开 Web UI 时,可使用 60 秒、单次有效的交接码自动导入密钥,原始密钥不会进入 URL。热重载轮换或删除密钥时,需用当前运行密钥鉴权:`llm-proxy reload --admin-key <当前密钥>`(也可设置 `LLM_PROXY_ADMIN_KEY`)。
|
|
197
|
+
|
|
198
|
+
macOS App 与 Web UI 的界面语言分别保存在本机和当前浏览器,不再修改服务端 `locale`。服务端 `locale` 仅控制服务日志和后端消息语言。
|
|
199
|
+
|
|
200
|
+
### 反向代理路径
|
|
201
|
+
|
|
202
|
+
Web UI 会根据当前 `/admin` 页面路径自动解析反向代理前缀。例如将服务发布到 `/llm-proxy/` 时,Nginx 只需正常转发路径:
|
|
203
|
+
|
|
204
|
+
```nginx
|
|
205
|
+
location /llm-proxy/ {
|
|
206
|
+
proxy_pass http://127.0.0.1:9000/;
|
|
207
|
+
proxy_set_header Host $host;
|
|
208
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
209
|
+
proxy_set_header Authorization $http_authorization;
|
|
210
|
+
proxy_buffering off;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
不要使用 `sub_filter` 全局替换 `/admin`。它会同时改写内联 JavaScript 的正则表达式,导致 Web UI 在加载时出现语法错误。
|
|
195
215
|
|
|
196
216
|
## 协议转换矩阵
|
|
197
217
|
|