Bundle
dsh-model-center
DSH 模型中心插件:免费模型目录 / 真免费实测 / 价格余额 / 一键切换 / 用量统计 — Model center plugin for DeepSeek Harness
- Source
- artwar2020
- stars
- 1 stars
- License
- MIT
- Updated
- Updated yesterday
Readme
# dsh-model-center
[](./LICENSE)
一个 [DeepSeek Harness (DSH)](https://github.com/deepseek-ai) 的模型中心插件:把散落各处的「免费模型目录、优惠价格、账户余额、真实可用性、用量统计」聚合到 Web 界面的一张卡片里,并支持一键切换路由模型。
## 功能特性
### 🆓 免费模型目录
- 聚合 [OpenRouter](https://openrouter.ai) 全部 `:free` 模型,自动过滤非文本模态
- 综合 **Artificial Analysis 智能指数 / 竞技场 Elo / 参数量** 三路信号,给出统一能力分(0-100)与 ★1-5 能力星级
- 自动推导专长标签:`推理` `视觉` `代码` `多模态` `前端设计` `高速推理` 等
- 展示上下文长度、参数量、是否支持工具调用 / 推理模式
### 🔬 真免费实测
- 「免费」不代表可用——一键向 OpenRouter 发极小请求(`max_tokens=1`)探测 `:free` 模型的**真实可用性**
- 返回实测状态(正常 / 限流 / 异常)与耗时;结果缓存 5 分钟
- 只对 `:free` 模型发请求,绝不触碰付费模型产生费用
### 💰 价格与余额
- [TeamoRouter](https://teamorouter.cn) 价格表(USD/1M tokens)、原价/优惠对照
- 账户余额实时查询
- 支持国内价格表扩展(`~/.dsh/model-prices.json`)
### 🔀 一键切换
- 在卡片内直接切换当前路由模型,无需离开界面
### 📊 用量统计
- 自动寄养挂载 [`@abcdefu_cja/dsh-usage-stats`](https://github.com/abcdefu-cja/dsh-usage-stats) 的计量后端:
插件退役其 UI 后,`/api/dsh-usage-stats/*` 路由与持久化状态由本插件继续承载,历史用量数据无缝延续
### 🧭 上下文长度(v1.0.1+)
- 「优惠模型」与「切换模型」列表自动显示每个模型的上下文窗口(`ctx 1M` / `ctx 128K`)
- TeamoRouter 价格接口本身不带该字段:宿主端从 OpenRouter 全量目录按「精确 id → 目录尾段 id → 规范化名称」三级匹配富化,目录缓存 24 小时
- 目录中不存在的模型不显示 ctx(不编造数据)
## 安装
```bash
dsh plugin --profile web add github:artwar2020/dsh-model-center
```
重启 DSH Web 后即可在界面中看到「模型中心」卡片。
## 配置(均可选)
插件从 `~/.dsh/.credentials.yaml` 读取以下 key,**不配置也能用**(仅对应功能隐藏):
| Key | 作用 | 缺失时 |
|---|---|---|
| `TEAMOROUTER_API_KEY` | TeamoRouter 价格表与余额查询 | 隐藏价格/余额板块 |
| `OPENROUTER_API_KEY` | 免费模型真免费实测 | 实测按钮提示未配置 |
```yaml
# ~/.dsh/.credentials.yaml 示例
TEAMOROUTER_API_KEY: sk-xxxx
OPENROUTER_API_KEY: sk-or-v1-xxxx
```
> 密钥只在本机使用:仅在请求对应上游 API 时作为 Bearer 头发送,不会出现在任何日志或界面中。
## 架构与 API
宿主端注册以下**只读、仅回环地址可访问**的 JSON 路由(带定期缓存):
| 路由 | 内容 | 缓存 |
|---|---|---|
| `GET /api/mc/free?force=1` | 免费模型目录(含评分/星级/标签) | 6 小时 |
| `GET /api/mc/pricing` | TeamoRouter 价格表 | 5 分钟 |
| `GET /api/mc/balance` | 账户余额 | 2 分钟 |
| `GET /api/mc/prices` | 国内价格表(本地文件) | 即时 |
| `GET /api/mc/probe?model=<id>` | 单个 `:free` 模型真免费实测 | 5 分钟 |
安全围栏:所有路由镜像 DSH pairing 路由的 loopback 校验(远端 IP / Host / Origin 三重检查),外部访问一律 403。
## 目录结构
```
├── package.json # 插件清单(dsh bundle + client 注入声明)
├── cordis.patch.yml # 插件挂载点
└── lib/
├── index.js # 宿主端:数据聚合 / 缓存 / 路由注册
└── client.js # Web 客户端:「模型中心」卡片 UI
```
## License
[MIT](./LICENSE)
Install
dsh plugin --profile web add github:artwar2020/dsh-model-center
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-model-center from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.