DeepSeek-harness-Extension

by Crayonnan

0 用量与计费github 检测到 manifest package.json#dsh收录于 08-16

轻量级配额栏插件,适用于DeepSeek Harness网页GUI——会话头部的一个药丸形图标显示当前配额,包含使用情况、余额、缓存命中率仪表盘…

A lightweight quota bar plugin for the DeepSeek Harness web GUI — a pill in the session header showing your current quota, with a dashboard for usage, balance, cache-hit rate…

安装

dsh plugin --profile web add github:Crayonnan/DeepSeek-harness-Extension

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

目录

中文 | English

一个轻量的 额度栏 插件,运行在 DeepSeek Harness Web GUI 里:会话头部右侧常驻一个额度胶囊,点开是仪表盘——套餐用量、账户余额、缓存命中率、各模型花费一目了然。

功能

  • 额度胶囊(会话头部右侧):显示 OpenCode Go 套餐最差窗口剩余百分比,或 DeepSeek API 账户余额。
  • 仪表盘(点击展开):
    • 配额行:OpenCode Go 三个用量窗口(5小时滚动 / 每周 / 每月,已用% + 进度条 + 限额 + 重置时间),或 DeepSeek 余额卡(总余额 / 充值 / 赠送)。
    • 会话统计胶囊:缓存命中率、输入 / 输出 tokens、上下文占用率(实时来自宿主投影)。
  • 模型花费:聚合所有持久会话日志,按模型展示 token 用量与预估花费(USD),横向成本占比条 + 合计。
  • 提供商自动识别(跟随默认模型);API Key 经 DSH 凭据缝解析,绝不离开宿主。

设计结构

双面 Cordis 插件(纯 ESM,无需构建步骤):

部分 文件 职责
宿主 index.js TypertRemoteService,两个 RPC 方法:status() 实时查询提供商额度/余额;usage() 用 zstd 解码全部会话日志(~/.dsh/sessions/**/session.jsonl.zstd),按 (turn, step) 末样本折叠用量并归属到对应模型,再按 pi-ai 目录定价(USD / 1M tokens,约 15s 缓存)。
客户端 client.js 手写浏览器 bundle,注册 conversation.session.header.utilities 槽位条目;渲染胶囊与仪表盘;实时读取 tokenUsage / contextPressure 会话投影。
清单 typert.host.js 两个 RPC 方法的严格模式 zod schema。

安装

dsh plugin --profile web add "github:Crayonnan/DeepSeek-harness-Extension"

在 $DSH_HOME/profiles/web/cordis.patch.yml 中添加:

- insert:
    - id: quota-bar
      name: 'dsh-quota-bar'

重启 dsh web。

网络受限?若 codeload.github.com 不可达,可用:dsh plugin --profile web add "git+https://github.com/Crayonnan/DeepSeek-harness-Extension.git"

配置

- id: quota-bar
  name: dsh-quota-bar
  config:
    opencodeUsageUrl: https://opencode.ai/zen/go/v1/usage  # 默认
    deepseekBaseUrl: https://api.deepseek.com              # 默认
    timeoutMs: 15000                                       # 默认
    sessionsRoot: <绝对路径>                                # 可选;默认 $DSH_HOME/sessions
    modelCosts:                                            # 可选;覆盖目录定价(USD / 1M tokens)
      kimi-k3: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 }

定价优先级:内置表 < pi-ai 模型目录(<provider>.json)< modelCosts。

卸载

删除 patch 行,然后执行 dsh plugin --profile web remove dsh-quota-bar。

许可

MIT

原始 README: https://github.com/Crayonnan/DeepSeek-harness-Extension/blob/main/README.zh-CN.md ↗