deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
dsh-deepseek-usage is a DSH plugin that shows real-time DeepSeek API token usage, estimated cost, and account balance right in the DSH Web UI (wallet button next to the composer tool row).
GET /user/balance API — the API key never leaves the processDEEPSEEK_PLATFORM_TOKEN) or ⚪ DSH-side estimation — automatic fallback when the platform token is absent or expired以下为中文文档 / Chinese documentation below:
DSH 插件:在 DSH Web 界面实时显示 DeepSeek API 的 token 消耗、估算花费 与 账户剩余金额。
deepseek-v4-flash → v4-flash,deepseek-v4-pro → v4-pro),完整模型名以 title 提示显示。tokenUsage session projection(dsh-token-meter,实时推送、压缩安全)。usageByModel projection 单元,按「日期 → 模型」折叠每个会话的 usage(重放/压缩安全),经变更流实时汇入全局存储;启动时从持久化会话日志全量回填历史。GET https://api.deepseek.com/user/balance,服务端经 DEEPSEEK_API_KEY 凭据定时(默认 60s)拉取;API Key 不出进程。GET https://platform.deepseek.com/api/v0/usage/cost?month=&year=(返回与官方账单一致的按日消耗),服务端经 DEEPSEEK_PLATFORM_TOKEN 凭据定时拉取;token 不出进程,未配置时自动回退估算口径。$DSH_HOME/deepseek-usage/usage-store.json(防抖写盘,损坏自动回退空存储)。构建:pnpm install && pnpm build
挂载(web profile):
~/.dsh/profiles/web/package.json:
{
"dependencies": {
"dsh-deepseek-usage": "file:/Users/<you>/work/opensource/dsh-deepseek-usage"
},
"dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-deepseek-usage"] } }
}
在 profile 目录执行 pnpm install,重启 dsh web。
| 键 | 默认 | 说明 |
|---|---|---|
balanceUrl |
https://api.deepseek.com/user/balance |
余额接口地址 |
refreshIntervalMs |
60000 |
余额轮询间隔(毫秒) |
apiKeyRef |
DEEPSEEK_API_KEY |
凭据引用(~/.dsh/.credentials.yaml / 环境变量) |
prices |
官方价(见下) | 按模型 key 的计价表(每百万 tokens 人民币) |
defaultPriceKey |
deepseek-v4-flash |
未匹配模型的兜底计价 key |
storePath |
$DSH_HOME/deepseek-usage/usage-store.json |
全局用量存储文件 |
platformTokenRef |
DEEPSEEK_PLATFORM_TOKEN |
平台 session token 凭据引用;配置后「今日 / 近 7 天」显示官方口径金额 |
默认计价(DeepSeek 官方 2026-08 现行价,每百万 tokens):
| 模型 | 输入(缓存命中) | 输入(未命中) | 输出 |
|---|---|---|---|
| deepseek-v4-flash | ¥0.02 | ¥1 | ¥2 |
| deepseek-v4-pro | ¥0.025 | ¥3 | ¥6 |
官方没有公开的用量查询 API,但平台控制台(platform.deepseek.com)登录后有一个内部用量接口,可用于查询按日消耗。取 token:
JSON.parse(localStorage.getItem('userToken')).value~/.dsh/.credentials.yaml 或环境变量):DEEPSEEK_PLATFORM_TOKEN: <token>
dsh web。面板「今日 / 近 7 天」标题旁的小圆点变绿即官方口径;token 过期时显示错误提示并自动回退估算。注意:官方将于 2026-08-17 起改为峰谷定价(高峰 9:00-12:00、14:00-18:00,空闲时段半价)。插件按单一价目估算;届时可通过
prices配置覆盖。
pnpm typecheck / pnpm test(vitest:计价、余额解析、用量折叠、聚合与持久化单测)pnpm build:tsc 编译服务端 → lib/,并复制手写客户端 bundle client/client.js → lib/client.jswindow.__ModuleLoader__.load),零构建依赖,改 client/client.js 后重跑 pnpm build 并在 profile 重新 pnpm install、重启 dsh web。CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。