fix(sync): OpenCode 模型改用官方 models 接口,修复文档改版导致的连续两天 exit=2
官方把文档的 `## Endpoints` 表改成「看 console 页 / 用 models 接口」, HTML 里不再有带 opencode.ai/ 地址的模型行,fetch_opencode() 的 <tr>/<td> 解析拿不到任何行 → 自动化日报「模型清单同步」整块失败: [2026-11-17 23:02:18] exit=2 RuntimeError: OpenCode 文档没解析出 Endpoints 表 [2026-11-18 23:02:29] exit=2 同上 改为优先读官方 models 接口(实测无需鉴权): GET https://opencode.ai/inference/go/v1/models (zen/go/v1/models 同源同内容) 每条自带 id/name/type/api{chat-completions,responses,messages,generate-content}/ recommended_api/limit{context,output}/cost.text.*.price/go.limited_regions, 据此推导协议线、免费标记与地区限制;HTML 表解析降级为兜底(接口不可用才走)。 首次落盘: - 删除 opencode/mimo-v2.5、mimo-v2.5-pro(上游已被 V2.6 取代) - 上下文 hy4-flash-free → 1048576/65536;qwen4-max → 1000000/262144 - 跳过 gemini-4-argon(仅 generate-content)、beam-free 与 muse-spark-1.2/1.3(地区限制) 验证:落盘后 28 个模型、/healthz 200、hot_reload 自动生效未重启、重跑「无漂移」; sync_onemin.py 同步通过(49 接口 / 43 配置 / 跳过重名 6)。 顺带把运行时的 data/ban_history.jsonl 加进 .gitignore(含被封 IP,属隐私)。
This commit is contained in:
1 parent
2eee87f5fa
commit
83ecea482f
4 files changed
+190
-22
No files matched your search
@@ -1,5 +1,40 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 2026-11-19 · 修 OpenCode 模型同步(官方文档改版导致连续两天 exit=2)
|
||||
|
||||
**症状**:自动化日报的「三、模型清单同步」整块失败,`logs/model-sync.log` 连续两天:
|
||||
|
||||
```
|
||||
[2026-11-17 23:02:18] exit=2 抓取/解析失败:RuntimeError: OpenCode 文档没解析出 Endpoints 表(页面可能改版)
|
||||
[2026-11-18 23:02:29] exit=2 同上
|
||||
```
|
||||
|
||||
**根因**:官方把 `## Endpoints` 表改成了「去 console 页看 / 用 models 接口」,
|
||||
HTML 里已经没有带 `opencode.ai/` 地址的模型行,`fetch_opencode()` 的 `<tr>/<td>` 解析拿不到任何行。
|
||||
|
||||
**修法**:改为优先读官方 models 接口(**无需鉴权**,实测不带 token 也 200):
|
||||
|
||||
```
|
||||
GET https://opencode.ai/inference/go/v1/models # 与 /zen/go/v1/models 同源同内容
|
||||
```
|
||||
|
||||
每条模型自带 `id` / `name` / `type` / `api{chat-completions,responses,messages,generate-content}` /
|
||||
`recommended_api` / `limit{context,output}` / `cost.text.*.price`(都为 0 = 免费)/ `go.limited_regions`。
|
||||
脚本据此推导协议线、免费标记、地区限制,**HTML 表解析降级为兜底**(接口不可用才走)。
|
||||
|
||||
**同步结果**(2026-11-19 08:02 首次落盘):
|
||||
|
||||
| 动作 | 内容 |
|
||||
|---|---|
|
||||
| 删除 | `opencode/mimo-v2.5`、`opencode/mimo-v2.5-pro`(上游已被 V2.6 取代,文档也不再收录)|
|
||||
| 上下文 | `hy4-flash-free` → 1,048,576 / 65,536;`qwen4-max` → 1,000,000 / 262,144 |
|
||||
| 跳过 | `gemini-4-argon`(只有 generate-content 线);`beam-free`、`muse-spark-1.2/1.3-contributor`(`go.limited_regions`,与旧硬编码名单一致)|
|
||||
|
||||
落盘后网关 28 个模型、`/healthz` 200,`hot_reload` 自动生效未重启;再跑一次输出「无漂移」。
|
||||
`sync_onemin.py` 同步验证通过(49 接口 / 43 配置 / 跳过重名 6)。
|
||||
|
||||
---
|
||||
|
||||
## 2026-10-31 · 新增 1min.AI 供应商(43 个模型)
|
||||
|
||||
老板:「查看 https://docs.1min.ai/docs/api/openai-compatible 文档,把 1min 供应商加入 ai 网关项目里」。
|
||||
|
||||
Reference in new issue
Block a user