ganfne123/dsh-plugin-api-quota ↗★ 0
dsh-plugin-api-quota
DSH Web UI plugin: check your DeepSeek API key balance/quota (GET /user/balance) from the sidebar, with a GUI panel showing total/granted/topped-up balance.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ganfne123/dsh-plugin-api-quota说明文档
阅读完整 README ↗dsh-plugin-api-quota
DSH Web UI 插件 — 在侧边栏查看你的 DeepSeek API key 额度。
功能
在 Web 侧边栏底部(设置按钮旁)新增 API 额度 入口,点击弹出面板,通过 DeepSeek 官方余额接口(GET /user/balance)查询当前 API key 的额度:
- 总额度、赠送额度、充值额度
- 币种与可用状态
- 查询时间,支持一键刷新
API key 永远不会进入浏览器:浏览器半只请求同源的 /api-quota/balance 路由(由插件 host 半提供),host 半通过凭据服务(ctx.credentials)解析 key 并在服务端访问 DeepSeek。
工作原理
| 半区 | 职责 |
|---|---|
Host(src/index.ts) | 在 web server 注册 GET /api-quota/balance;通过 ctx.credentials 解析 DEEPSEEK_API_KEY,调用 https://api.deepseek.com/user/balance |
浏览器(src/client/) | 注册 sidebar.footer.action 槽位;请求该路由并渲染余额面板(Modal) |
凭据引用与端点均可通过插件配置调整(apiKeyEnv、baseURL、balancePath),默认值为 DEEPSEEK_API_KEY / https://api.deepseek.com / /user/balance。
快速开始
DSH 插件安装进 profile(dsh web → web profile)。安装后重启 dsh web 即可。
# 在插件仓库根目录
npm install && npm run build
# 在 profile 补丁层注册(~/.dsh/profiles/web/cordis.patch.yml):
# - insert:
# - id: plugin-api-quota
# name: dsh-plugin-api-quota
# symlink 进 profile 的 node_modules:
# ln -s "$PWD" ~/.dsh/profiles/web/node_modules/dsh-plugin-api-quota
配置项
| 字段 | 默认值 | 含义 |
|---|---|---|
apiKeyEnv | DEEPSEEK_API_KEY | 持有 API key 的凭据引用(环境变量形状) |
baseURL | https://api.deepseek.com | DeepSeek API 基础地址 |
balancePath | /user/balance | 附加到 baseURL 的余额接口路径 |
License
MIT