@maplezzk/llm-proxy 0.26.0 → 0.28.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 CHANGED
@@ -78,6 +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 scoped to the current service for protected management endpoints
81
82
  - **Proxy key**: Set API authentication key
82
83
  - **Live test**: Send test requests directly to verify configuration
83
84
  - **Protocol capture**: Real-time request/response inspection
@@ -191,8 +192,10 @@ llm-proxy status # Show status
191
192
  | `/admin/logs/stats` | GET | Log statistics |
192
193
  | `/admin/token-stats` | GET | Token usage stats |
193
194
  | `/admin/log-level` | GET / PUT | Read / update log level |
194
- | `/admin/locale` | GET / PUT | Read / update UI locale (zh / en) |
195
- | `/admin/port` | GET / PUT | Read / update listening port (requires restart) |
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 |
196
199
  | `/admin/proxy-key` | GET / PUT | Read / update proxy auth key |
197
200
  | `/admin/vision` | GET / PUT | Read / update external-vision config |
198
201
  | `/admin/vision-cache/stats` | GET | Vision cache hit / miss / size |
@@ -204,6 +207,10 @@ llm-proxy status # Show status
204
207
  | `/admin/test-adapter` | POST | Send a test request through an adapter |
205
208
  | `/admin/debug/captures/*` | GET / POST | Protocol capture ring buffer + SSE stream |
206
209
 
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
+
207
214
  ## Protocol Translation Matrix
208
215
 
209
216
  | Source | Target | Non-streaming | Streaming (SSE) |
package/README.zh.md CHANGED
@@ -78,6 +78,7 @@ llm-proxy start
78
78
  - **Provider 管理**:增删改 AI 服务商、拉取远程模型列表、声明输入模态(文本/图片)
79
79
  - **适配器配置**:创建带模型重映射和协议转换的虚拟端点
80
80
  - **识图设置**:为不支持图片的模型启用外挂识图、查看缓存命中率
81
+ - **管理密钥**:按当前服务地址保存独立的管理 API 密钥,用于访问受保护的管理接口
81
82
  - **代理密钥**:设置 API 认证密钥
82
83
  - **连通性测试**:直接发送测试请求验证配置
83
84
  - **协议抓包**:实时查看请求/响应原文
@@ -90,6 +91,7 @@ llm-proxy start
90
91
  log_level: debug # debug | info | warn | error
91
92
  port: 9000 # 可选:默认 9000
92
93
  max_body_size: 10485760 # 可选:请求体大小上限(字节,默认 10MB)
94
+ admin_key: ${ADMIN_KEY} # 可选:保护管理 API;/admin 页面外壳保持公开
93
95
  proxy_key: sk-xxx # 可选:设置后 /v1/* 需认证
94
96
 
95
97
  providers:
@@ -176,8 +178,10 @@ llm-proxy status # 查看状态
176
178
  | `/admin/logs/stats` | GET | 日志统计 |
177
179
  | `/admin/token-stats` | GET | Token 统计 |
178
180
  | `/admin/log-level` | GET / PUT | 查看 / 修改日志级别 |
179
- | `/admin/locale` | GET / PUT | 查看 / 修改界面语言(zh / en) |
180
- | `/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 兑换一次性交接码 |
181
185
  | `/admin/proxy-key` | GET / PUT | 查看 / 修改代理认证密钥 |
182
186
  | `/admin/vision` | GET / PUT | 查看 / 修改外挂识图配置 |
183
187
  | `/admin/vision-cache/stats` | GET | 识图缓存命中率 / 容量 |
@@ -189,6 +193,10 @@ llm-proxy status # 查看状态
189
193
  | `/admin/test-adapter` | POST | 通过适配器发送测试请求 |
190
194
  | `/admin/debug/captures/*` | GET / POST | 协议抓包环形缓冲 + SSE 推送 |
191
195
 
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
+
192
200
  ## 协议转换矩阵
193
201
 
194
202
  | 源 | 目标 | 非流式 | 流式 (SSE) |
@@ -255,4 +263,4 @@ rm ~/.llm-proxy/vision-cache.json
255
263
 
256
264
  **识图缓存在哪里?** `~/.llm-proxy/vision-cache.json`,重启后保留,5s 防抖刷盘。
257
265
 
258
- **怎么给模型开启图片输入?** 在管理界面 → Providers → 编辑模型 → 勾选 **输入模态 → 图片**,或在 `config.yaml` 中加 `input: [text, image]`。未声明 `image` 的模型在配置了 `vision:` 后会自动走外挂识图。
266
+ **怎么给模型开启图片输入?** 在管理界面 → Providers → 编辑模型 → 勾选 **输入模态 → 图片**,或在 `config.yaml` 中加 `input: [text, image]`。未声明 `image` 的模型在配置了 `vision:` 后会自动走外挂识图。