golitter/dsh-deepseek-billing 预览 preview

golitter/dsh-deepseek-billing

Plugin插件 Native原生 ⭐ 2 Usage & Cost用量与计费

在DSH中查看DeepSeek API账户余额与计费信息

Project Overview项目介绍

dsh-deepseek-billing is a DeepSeek Harness plugin that adds a Billing page to the Web settings, showing DeepSeek account available, top-up, and gifted balances. It supports manual refresh, error states, retention of the last successful balance and update time, real-time Chinese/English switching, light/dark themes, and narrow-screen adaptation. The API key is read securely from the DSH credential store and never sent to the browser. A /deepseek-billing slash command queries balance inline; in blank sessions results show as ephemeral toasts that clear on activation or after one minute. The plugin does not implement usage history, trends, alerts, auto top-up, or key management. timeoutMs must be a finite number greater than 0 and not exceeding 120000.

dsh-deepseek-billing 是 DeepSeek Harness 的计费插件,在 Web 设置页添加“计费/Billing”页面,展示 DeepSeek 账户可用、充值和赠送余额,支持手动刷新、错误回退、保留最近成功值与更新时间,并提供中英文实时切换、明暗主题与窄屏适配。API Key 由 DSH 凭证库读取,不会暴露到浏览器。可在对话中用斜杠命令 /deepseek-billing 快速查询,空白会话中以临时提示显示,激活或1分钟后自动清除。插件不实现消费历史、趋势、告警、自动充值或密钥管理。timeoutMs 必须为大于0且不超过120000的有限值,避免定时器溢出。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:golitter/dsh-deepseek-billing

golitter/dsh-deepseek-billing 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-deepseek-billing

简体中文 · English

功能概述

DeepSeek Harness 的 Web 设置页中增加“计费 / Billing”页面,提供:

  • DeepSeek API 可用余额、充值余额和赠送余额展示
  • 手动刷新及加载、空数据、错误状态;刷新失败时保留最近一次成功余额和更新时间
  • 中文、英文实时切换
  • 明暗主题与窄屏适配
  • API Key 通过 DSH 凭证库安全读取,不会发送到浏览器
  • 对话内斜杠命令 /deepseek-billing 快速返回余额;新建空白会话保持当前页面并显示临时提示,提示在会话激活、1 分钟到期或切换离开时自动清除,空白阶段的查询记录不会在会话激活后重新出现

第一性原理

这个插件只解决一个最基本的问题:在不暴露 API Key 的前提下,让用户可靠地看到 DeepSeek 账户的真实余额。

因此,当前功能有意保持克制:宿主负责安全读取凭据并请求 DeepSeek 官方余额接口,客户端只展示接口返回的余额,并提供手动刷新和稳定的错误反馈。插件不实现消费历史、趋势图、用量预测、余额告警、自动充值或 API Key 管理等扩展能力;这些功能要么缺少可靠的数据来源,要么超出了“查询余额”这一核心职责。没有实现它们是基于第一性原理做出的范围选择,而不是用虚构数据填充界面。

安装与使用

  1. 安装插件:

    dsh plugin --profile web add github:golitter/dsh-deepseek-billing
    
  2. $DSH_HOME/.credentials.yaml 中配置 DeepSeek API Key:

    version: 1
    
    refs:
      DEEPSEEK_API_KEY: sk-xxxxxxxxxxxxxxxx
    

    DSH 启动时会迁移已存在的旧扁平凭据文档;新文档请直接使用 version: 1refs 格式。POSIX 系统上应限制文件权限,例如 chmod 600 "$DSH_HOME/.credentials.yaml";不要在文档、日志或截图中记录真实密钥。

  3. 启动 DSH Web:

    dsh --profile web
    
  4. 打开“设置 → 计费 / Billing”查看余额;点击“刷新 / Refresh”可重新获取。首次请求失败会显示完整错误状态;已有余额后的刷新失败会保留旧余额,并在页面中显示非阻塞提示。

    DeepSeek 计费插件中文界面

    DeepSeek billing plugin English interface

  5. 也可在对话中直接输入无参数命令 /deepseek-billing 快速查看余额;在新建空白会话中,结果显示在输入框旁的临时提示中,不会进入对话记录页,并在会话激活、1 分钟到期或切换离开时自动清除;空白阶段执行过的余额命令不会在会话激活后重新显示为历史卡片。宿主已保存 zh/en 偏好时,斜杠菜单说明、标签、空态、错误和用法提示跟随语言并在切换后更新;远程浏览器仅有进程内语言或偏好不可用时,菜单说明回退英文,结果回退为不带标签的「币种 + 金额」、固定英文用法提示及稳定错误码。

    使用 deepseek-billing 斜杠命令查询余额

配置与安全

详见 配置与安全。其中 timeoutMs 必须为大于 0 且不超过 120000 毫秒的有限数值,避免 Node.js 定时器溢出;设置页的等待超时会自动对齐该值(响应中附带 timeoutMs,客户端按其加余量对齐)。

上一个 Prev dsh-background 下一个 Next dsh-expmem