| # Accounting model | ||
| `dsh-usage` derives usage from the durable DeepSeek Harness session log. It does not create another event stream or usage database, so replay, resume, compaction, and Web clients observe the same source of truth. | ||
| ## Token buckets | ||
| The plugin keeps four disjoint provider-reported buckets: | ||
| - uncached input; | ||
| - cache read; | ||
| - cache write; | ||
| - output. | ||
| The turn footer presents `Input` as uncached input plus cache-write input and `Cache` as provider-reported cache-read input. Reasoning tokens already included in output are never counted twice. | ||
| ## Turn summaries | ||
| Every finalized turn with reported usage displays a compact line in the assistant action row: | ||
| `Total 133K tokens · Input 1.1K · Cache 132K · Output 725 · Cost $0.0003276 USD` | ||
| Values come from the durable whole-log `modelCost.byTurn` projection, not only the currently loaded messages. History paging and compaction therefore do not shrink an older turn's reading. If a provider reports no usage, the footer stays absent instead of presenting a misleading zero. | ||
| Cost appears only when every model call in the turn reports usage and matches a configured rate. A partial amount is never presented as the turn total. | ||
| ## Settings → Usage | ||
| The independent Usage page starts in **All sessions** scope and provides: | ||
| - total, input, cache, and output tokens; | ||
| - model-call count and estimated cost; | ||
| - a keyboard-accessible 52-week UTC activity heatmap; | ||
| - provider/model totals; | ||
| - per-session totals, or per-turn totals after choosing a session. | ||
| The heatmap uses total token volume relative to the busiest visible day. Hover, focus, or click a day for exact Input, Cache, Output, and Cost. Daily buckets use UTC so replay stays stable across machines and time zones. | ||
| The page shows `--` for total cost whenever usage or pricing coverage is incomplete. The former `/cost` command is intentionally not registered because the turn footer and Usage page provide the same information without adding command rows to conversation history. | ||
| ## Forks and sub-Agents | ||
| Forked and sub-Agent sessions are measured from their durable lineage boundary. Inherited seed events are subtracted, while every new child model call remains counted, including provider-reported cache reads. | ||
| Community retries send complete absolute snapshots with stable revision/digest semantics. Accepted newer snapshots replace older rows for the same device instead of being accumulated again. | ||
| ## Coverage | ||
| The projection currently covers: | ||
| - ordinary agent-loop calls from `assistant/chunk` and `assistant/message` usage; | ||
| - successful compaction model calls from `compaction/summary` usage; | ||
| - model switches, effective-dated price changes, cache reads, and cache writes; | ||
| - calls with usage but no configured price, marked `unpriced`; | ||
| - entered agent steps and compactions without reported usage, marked `without usage`. | ||
| Harness session-title LLM events currently record the request route but not provider usage, so title-generation fees cannot be reconstructed. Calls made by plugins that neither attach usage to a durable event nor use the agent loop are also outside the projection. | ||
| ## Design note | ||
| The provider-neutral accounting and activity view build on ideas previously explored in Noval. Its separate JSONL usage store and metered wrapper are not copied because Harness already owns durable events, replay projections, model routes, and Web extension slots. |
| # Installation and troubleshooting | ||
| ## Requirements | ||
| - Node.js 22.18 or newer | ||
| - An existing DeepSeek Harness Web profile | ||
| ## Recommended: run Harness through npx | ||
| No global `dsh` or pnpm installation is required. The command pins the verified pnpm 11.9.0 installation baseline; pnpm 11.7.0 can fail while installing the plugin. | ||
| ```powershell | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.9.0 -- dsh plugin --profile web add dsh-usage | ||
| npx --yes @deepseek-ai/dsh --profile web --dump-config | ||
| npx --yes @deepseek-ai/dsh --profile web | ||
| ``` | ||
| Open the Web URL printed in the terminal. The first installation requires restarting Harness so its Web client discovers the plugin. | ||
| ## Globally installed dsh | ||
| If both `dsh` and pnpm are on `PATH`: | ||
| ```powershell | ||
| dsh plugin --profile web add dsh-usage | ||
| dsh --profile web --dump-config | ||
| dsh --profile web | ||
| ``` | ||
| ## Harness source checkout | ||
| Run inside the DeepSeek Harness repository: | ||
| ```powershell | ||
| pnpm dsh plugin --profile web add dsh-usage | ||
| pnpm dsh --profile web --dump-config | ||
| pnpm dsh --profile web | ||
| ``` | ||
| ## Upgrade | ||
| Run the recommended `plugin add` command again, then restart Harness: | ||
| ```powershell | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.9.0 -- dsh plugin --profile web add dsh-usage | ||
| ``` | ||
| ## Test a source checkout | ||
| Install dependencies and verify the package from the monorepo root: | ||
| ```powershell | ||
| pnpm install --frozen-lockfile | ||
| pnpm --filter dsh-usage run check | ||
| cd dsh-usage | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.9.0 -- dsh plugin --profile web add . | ||
| npx --yes @deepseek-ai/dsh --profile web --dump-config | ||
| npx --yes @deepseek-ai/dsh --profile web | ||
| ``` | ||
| Alternatively, run `pnpm dsh` from a Harness checkout and pass the path to the `dsh-usage` package directory. During browser development, Harness's `pnpm run dev:web` flow can HMR source changes after initial plugin discovery. | ||
| ## Troubleshooting | ||
| ### `dsh` is not recognized | ||
| Use the npx commands instead of the global CLI form. | ||
| ### The Usage page does not appear | ||
| Stop and restart the running Harness process after installation. Then complete one model response and reopen **Settings → Usage**. | ||
| ### Community requests cannot reach the network | ||
| Configure the proxy in the environment that launches DSH. Node.js 22.21+ and Node.js 24 can use standard `HTTP_PROXY` / `HTTPS_PROXY` variables when `NODE_USE_ENV_PROXY=1` is also set. The plugin does not read or change operating-system proxy settings. | ||
| Community failures never interrupt local Usage, heatmaps, turn summaries, or cost estimates. |
| # Price configuration | ||
| Cost is optional. Token accounting works without configured prices. | ||
| Every rate is one currency unit per million tokens. Matching is exact on the Harness provider route and provider-owned model id. Rates are effective-dated so replay uses the price active when an event was recorded instead of rewriting historical cost with today's price. | ||
| The bundled `cordis.patch.yml` contains the USD prices published for `deepseek-v4-flash` and `deepseek-v4-pro` on 2026-04-24. Provider prices can change; verify the [official DeepSeek pricing page](https://api-docs.deepseek.com/quick_start/pricing/) before relying on an estimate. | ||
| ## Example | ||
| ```yaml | ||
| - id: usage | ||
| name: dsh-usage | ||
| config: | ||
| currency: CNY | ||
| communityUrl: https://dshcommunity.com | ||
| rates: | ||
| - provider: deepseek-official | ||
| model: deepseek-v4-flash | ||
| effectiveFrom: '2026-04-24T00:00:00.000Z' | ||
| uncachedInput: 1 | ||
| cacheRead: 0.02 | ||
| cacheWrite: 1 | ||
| output: 2 | ||
| - provider: deepseek-official | ||
| model: deepseek-v4-pro | ||
| effectiveFrom: '2026-04-24T00:00:00.000Z' | ||
| uncachedInput: 3 | ||
| cacheRead: 0.025 | ||
| cacheWrite: 3 | ||
| output: 6 | ||
| ``` | ||
| Add a new row with a later `effectiveFrom` when a price changes. Do not edit an old row if historical replay matters. | ||
| Harness configuration layers replace a row's complete `config` value rather than deep-merging it. A profile override must repeat both `currency` and the full `rates` list. | ||
| ## Display rules | ||
| - Token totals remain visible without prices. | ||
| - Turn cost appears only when every call has usage and a matching rate. | ||
| - Page-level total cost displays `--` when coverage is incomplete. | ||
| - Community Sync never uploads cost. | ||
| All displayed cost is an estimate and does not replace the provider's bill. |
| # dsh-usage | ||
| [](https://www.npmjs.com/package/dsh-usage) | ||
| [](https://github.com/kestiny18/dsh-plugins/actions/workflows/ci.yml) | ||
| [](./LICENSE) | ||
| [English](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/README.md) · **简体中文** | ||
| 看清每一次 AI 调用消耗了多少 Token。`dsh-usage` 为 DeepSeek Harness Web 增加单轮用量摘要、模型费用估算和 52 周活动面板。 | ||
| > 这是由社区独立维护的插件,并非 DeepSeek 官方插件。费用是估算值,不代表供应商最终账单。 | ||
|  | ||
| ## 你会得到什么 | ||
| - 每轮对话结束后显示简洁的 `Total · Input · Cache · Output · Cost` 摘要。 | ||
| - 独立的 **设置 → Usage** 页面,可按模型、会话和单轮查看用量。 | ||
| - 基于持久化会话历史生成的 GitHub 风格 52 周热力图。 | ||
| - 与 Provider 无关的统计:只要模型返回标准 usage,就能记录 Token。 | ||
| - 完全可选、默认关闭的 [DSH Community](https://dshcommunity.com) 聚合数据分享。 | ||
| 插件直接回放 Harness 已有的 Session 日志,不会再创建一套用量数据库。本地 Usage 始终独立于 Community 登录和网络状态。 | ||
| ## 30 秒安装 | ||
| 需要 Node.js 22.18 或更高版本,以及已有的 DeepSeek Harness Web Profile。 | ||
| ```powershell | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.9.0 -- dsh plugin --profile web add dsh-usage | ||
| npx --yes @deepseek-ai/dsh --profile web --dump-config | ||
| npx --yes @deepseek-ai/dsh --profile web | ||
| ``` | ||
| 打开终端输出的 Web 地址,完成一次模型回复,然后查看对话下方的用量摘要和 **设置 → Usage**。首次安装后需要重启 Harness,让 Web 客户端发现新插件。 | ||
| 命令固定使用已经验证可用的 pnpm 11.9.0 安装基线。不要换成 pnpm 11.7.0,该版本可能在安装插件时失败。 | ||
| [升级、全局 CLI、源码运行、代理和故障排查](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/installation.md) | ||
| ## 是否加入 Community,由你决定 | ||
| 连接 GitHub 和开启 Community Sync 是两个独立选择。GitHub 登录只用于确认公开身份,**不会**自动上传数据;只有你在 **设置 → Usage** 中主动打开同步开关后,插件才会发送聚合数据。 | ||
| 开启后只上传按天和按模型汇总的请求数及 Token 总量。提示词、回复、Session 内容、工具内容、路径、主机名、硬件标识和费用都不会上传。未知或私有模型路由会在本地合并为 `other`。即使同步失败,本地 Usage 也不会受到影响。 | ||
| [查看排行榜和图文安装指南 →](https://dshcommunity.com) | ||
|  | ||
| ## 可信的统计口径 | ||
| 普通输入、缓存读取、缓存写入和输出分别统计。Provider 已经计入 Output 的推理 Token 不会重复计算。fork 和子 Agent 会扣除继承自父会话的 seed 事件,同时保留子 Agent 自己产生的新模型调用,包括缓存命中。 | ||
| 只有相关调用都提供 usage,并且都能匹配生效日期对应的价格时,才会显示费用。条件不完整时仍展示 Token,但省略 Cost,避免把部分费用误认为总费用。 | ||
| - [统计模型、覆盖范围和限制](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/accounting.md) | ||
| - [价格配置](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/pricing.md) | ||
| ## 相关链接 | ||
| - [DSH Community](https://dshcommunity.com) | ||
| - [npm 包](https://www.npmjs.com/package/dsh-usage) | ||
| - [源码仓库](https://github.com/kestiny18/dsh-plugins/tree/main/dsh-usage) | ||
| - [最初的介绍帖](https://github.com/deepseek-ai/deepseek-harness/discussions/1169) | ||
| - [问题与反馈](https://github.com/kestiny18/dsh-plugins/issues) | ||
| - [参与贡献](https://github.com/kestiny18/dsh-plugins/blob/main/CONTRIBUTING.md) | ||
| 采用 MIT License。 |
+12
-0
@@ -7,2 +7,14 @@ # Changelog | ||
| ## [0.2.5] - 2026-08-26 | ||
| ### Added | ||
| - Add a Simplified Chinese product README, Usage and Community screenshots, and focused installation, accounting, and pricing guides. | ||
| ### Changed | ||
| - Streamline the default GitHub/npm README around product value, one recommended install path, privacy boundaries, and advanced-documentation links. | ||
| - Pin public npx installation examples to the verified pnpm 11.9.0 baseline instead of pnpm 11.7.0. | ||
| - Use a user-facing npm package description focused on the Usage dashboard and estimated cost. | ||
| ## [0.2.4] - 2026-08-24 | ||
@@ -9,0 +21,0 @@ |
+4
-2
| { | ||
| "name": "dsh-usage", | ||
| "version": "0.2.4", | ||
| "description": "Replay-aware per-turn model usage and session cost for DeepSeek Harness", | ||
| "version": "0.2.5", | ||
| "description": "Token usage, estimated cost, and a 52-week activity dashboard for DeepSeek Harness Web", | ||
| "type": "module", | ||
@@ -38,2 +38,4 @@ "engines": { | ||
| "README.md", | ||
| "README.zh-CN.md", | ||
| "docs/**/*.md", | ||
| "CHANGELOG.md", | ||
@@ -40,0 +42,0 @@ "LICENSE" |
+38
-171
| # dsh-usage | ||
| Token usage, estimated model cost, and a 52-week activity heatmap for DeepSeek Harness Web. | ||
| [](https://www.npmjs.com/package/dsh-usage) | ||
| [](https://github.com/kestiny18/dsh-plugins/actions/workflows/ci.yml) | ||
| [](./LICENSE) | ||
| [npm](https://www.npmjs.com/package/dsh-usage) · [Source](https://github.com/kestiny18/dsh-plugins/tree/main/dsh-usage) · [Discussion](https://github.com/deepseek-ai/deepseek-harness/discussions/1169) | ||
| **English** · [简体中文](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/README.zh-CN.md) | ||
| `dsh-usage` adds: | ||
| See where your tokens go. `dsh-usage` adds per-turn token summaries, estimated model cost, and a 52-week activity dashboard to DeepSeek Harness Web. | ||
| - a compact `Total · Input · Cache · Output · Cost` summary below every completed turn; | ||
| - a full **Settings → Usage** page; | ||
| - totals by model, session, and turn; | ||
| - a GitHub-style 52-week activity heatmap; | ||
| - provider-neutral token accounting and optional estimated cost. | ||
| - optional aggregate-only DSH Community participation, disabled by default. | ||
| > Community plugin maintained independently from DeepSeek. Cost is an estimate, not a provider bill. | ||
| It reads Harness's durable session log and does not create a separate usage database. Any model or provider that reports standard usage data can contribute token totals. Cost is shown only when a matching price is configured. | ||
|  | ||
| ## Quick start | ||
| ## What you get | ||
| Requirements: Node.js 22.18 or newer and an existing DeepSeek Harness Web profile. | ||
| - A compact `Total · Input · Cache · Output · Cost` summary below every completed turn. | ||
| - A dedicated **Settings → Usage** page with totals by model, session, and turn. | ||
| - A GitHub-style 52-week activity heatmap built from durable session history. | ||
| - Provider-neutral accounting: any model that reports standard usage can contribute token totals. | ||
| - Optional aggregate-only participation in [DSH Community](https://dshcommunity.com), disabled by default. | ||
| ### Using Harness through npx | ||
| The plugin replays Harness's existing session log instead of creating another usage database. Local Usage remains independent from Community login and network availability. | ||
| Copy and run these commands from PowerShell, Command Prompt, or a terminal. No global `dsh` or pnpm installation is required: | ||
| ## Install in 30 seconds | ||
| ```powershell | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.7.0 -- dsh plugin --profile web add dsh-usage | ||
| npx --yes @deepseek-ai/dsh --profile web --dump-config | ||
| npx --yes @deepseek-ai/dsh --profile web | ||
| ``` | ||
| Requirements: Node.js 22.18 or newer and an existing DeepSeek Harness Web profile. | ||
| Then open the Harness Web URL printed in the terminal. Complete one model response and check: | ||
| - the usage summary below the assistant response; | ||
| - **Settings → Usage** for totals and the 52-week heatmap. | ||
| The first installation requires restarting Harness so that its Web client discovers the plugin. | ||
| ### Optional Community Sync | ||
| Visit [dshcommunity.com](https://dshcommunity.com) for the public leaderboard and illustrated setup guide. Open **Settings → Usage → DSH Community**. Connecting GitHub identifies your public Community account but does not upload anything. Turn **Community Sync** on separately to send the first full aggregate snapshot and refresh it every 30 minutes. | ||
| Community uploads contain UTC daily totals and normalized model totals: request counts plus uncached input, cache read, cache write, and output tokens. They do not contain cost, prompts, responses, session titles, tool content, paths, hostnames, or hardware identifiers. Unknown/private provider-model routes are combined into `other` locally before the request is created. | ||
| Forked and sub-Agent sessions are counted from their durable lineage boundary: inherited seed events are subtracted, while the child's new calls—including provider-reported cache reads—remain in the snapshot. Retries use absolute replacement totals and a stable revision/digest, so the Community never adds the same device/day snapshot twice. | ||
| Sync failures are shown in settings and never interrupt local session projection, turn footers, cost estimates, or the Usage page. Turning Sync off stops future uploads. **Sign out** in Settings revokes this installation's device credential, clears its local GitHub identity, and turns Sync off; it does not delete the Community account or previously accepted aggregate data. V1 does not delete previously accepted Community data. | ||
| If Node cannot reach the Community directly, configure the proxy in the environment that launches DSH. Node 22.21+ and Node 24 can use standard `HTTP_PROXY` / `HTTPS_PROXY` variables when `NODE_USE_ENV_PROXY=1` is also set. The plugin does not read or change operating-system proxy settings. | ||
| ### Using a globally installed dsh | ||
| If both `dsh` and pnpm are available on your `PATH`, use the shorter commands from the [original announcement](https://github.com/deepseek-ai/deepseek-harness/discussions/1169): | ||
| ```powershell | ||
| dsh plugin --profile web add dsh-usage | ||
| dsh --profile web --dump-config | ||
| dsh --profile web | ||
| ``` | ||
| ### Running from a Harness source checkout | ||
| Run these commands inside the DeepSeek Harness repository: | ||
| ```powershell | ||
| pnpm dsh plugin --profile web add dsh-usage | ||
| pnpm dsh --profile web --dump-config | ||
| pnpm dsh --profile web | ||
| ``` | ||
| ### Upgrade | ||
| Run the same `plugin add` command again, then restart Harness: | ||
| ```powershell | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.7.0 -- dsh plugin --profile web add dsh-usage | ||
| ``` | ||
| If `dsh` is not recognized, use the npx command above instead of the global-install form. If the Usage page does not appear after installation, stop and restart the running Harness process. | ||
| ## Develop from this repository | ||
| Install dependencies from the monorepo root, then build and verify this package: | ||
| ```powershell | ||
| pnpm install --frozen-lockfile | ||
| pnpm --filter dsh-usage run check | ||
| cd dsh-usage | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.7.0 -- dsh plugin --profile web add . | ||
| npx --yes --package=@deepseek-ai/dsh --package=pnpm@11.9.0 -- dsh plugin --profile web add dsh-usage | ||
| npx --yes @deepseek-ai/dsh --profile web --dump-config | ||
@@ -94,110 +35,36 @@ npx --yes @deepseek-ai/dsh --profile web | ||
| Alternatively, run `pnpm dsh` from a Harness checkout and replace `.` with the path to your `dsh-usage` package directory. Do not copy a machine-specific absolute path from this README. | ||
| Open the Web URL printed in the terminal, complete one model response, then check the turn summary and **Settings → Usage**. Restart Harness after the first installation so the Web client discovers the plugin. | ||
| During browser development, Harness's `pnpm run dev:web` flow can HMR later source changes after the initial plugin discovery. | ||
| The commands deliberately pin the verified pnpm 11.9.0 installation baseline. pnpm 11.7.0 can fail while installing the plugin. | ||
| ## How accounting works | ||
| [Upgrade, global CLI, source-checkout, proxy, and troubleshooting guide](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/installation.md) | ||
| The plugin prices four disjoint Harness usage buckets: uncached input, cache read, cache write, and output. Reasoning tokens are already included in output and are never charged twice. Price schedules are effective-dated, so replay uses the rate active when each event was recorded instead of rewriting historical cost with today's price. | ||
| ## Join the Community — only if you choose | ||
| The bundled `cordis.patch.yml` contains the USD prices published for `deepseek-v4-flash` and `deepseek-v4-pro` on 2026-04-24. DeepSeek can change prices; verify the [official pricing page](https://api-docs.deepseek.com/quick_start/pricing/) before relying on the estimate. | ||
| Connect GitHub and Community Sync are separate choices. Signing in identifies your public profile; it does **not** start an upload. Sync stays off until you explicitly enable it in **Settings → Usage**. | ||
| ## Configure rates | ||
| When enabled, the plugin uploads only aggregate daily/model request and token totals. It never uploads prompts, responses, session content, tool content, paths, hostnames, hardware identifiers, or cost. Unknown/private model routes are combined into `other` before the request is created. A failed sync never interrupts local Usage. | ||
| Every rate is one currency unit per million tokens. Matching is exact on both the Harness provider route and provider-owned model id. Add another row with a later `effectiveFrom` when a price changes; do not edit the old row if historical replay matters. | ||
| [Open the leaderboard and illustrated setup guide →](https://dshcommunity.com) | ||
| ```yaml | ||
| - id: usage | ||
| name: dsh-usage | ||
| config: | ||
| currency: CNY | ||
| communityUrl: https://community.example.com | ||
| rates: | ||
| - provider: deepseek-official | ||
| model: deepseek-v4-flash | ||
| effectiveFrom: '2026-04-24T00:00:00.000Z' | ||
| uncachedInput: 1 | ||
| cacheRead: 0.02 | ||
| cacheWrite: 1 | ||
| output: 2 | ||
| - provider: deepseek-official | ||
| model: deepseek-v4-pro | ||
| effectiveFrom: '2026-04-24T00:00:00.000Z' | ||
| uncachedInput: 3 | ||
| cacheRead: 0.025 | ||
| cacheWrite: 3 | ||
| output: 6 | ||
| ``` | ||
|  | ||
| Harness configuration layers replace a row's complete `config` value rather than deep-merging it, so a profile override must repeat both `currency` and the full `rates` list. | ||
| ## Trustworthy accounting | ||
| ## Web turn footer | ||
| Input, cache read, cache write, and output remain separate buckets. Reasoning tokens already reported as output are not counted twice. Forked and sub-Agent sessions subtract inherited seed events while retaining the child's new model calls, including provider-reported cache reads. | ||
| Every finalized turn displays one compact English-only line in the existing assistant action row: | ||
| Cost appears only when every relevant call has provider usage and a matching effective-dated rate. Otherwise token totals remain visible and cost is omitted instead of showing a misleading partial amount. | ||
| `Total 133K tokens · Input 1.1K · Cache 132K · Output 725 · Cost $0.0003276 USD` | ||
| - [Accounting model, coverage, and limitations](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/accounting.md) | ||
| - [Price configuration](https://github.com/kestiny18/dsh-plugins/blob/main/dsh-usage/docs/pricing.md) | ||
| - `Total` is `Input + Cache + Output`; | ||
| - `Input` is uncached input plus cache-write input; | ||
| - `Cache` is provider-reported cache-read input; | ||
| - `Output` is provider-reported output, including reasoning tokens. | ||
| ## Links | ||
| These values come from the durable whole-log `modelCost.byTurn` projection, not from the currently loaded page of messages, so history paging and compaction do not shrink an older turn's reading. If a provider reports no usage for a turn, the footer stays absent rather than presenting a misleading zero. | ||
| - [DSH Community](https://dshcommunity.com) | ||
| - [npm package](https://www.npmjs.com/package/dsh-usage) | ||
| - [Source repository](https://github.com/kestiny18/dsh-plugins/tree/main/dsh-usage) | ||
| - [Original discussion](https://github.com/deepseek-ai/deepseek-harness/discussions/1169) | ||
| - [Issues and feedback](https://github.com/kestiny18/dsh-plugins/issues) | ||
| - [Contributing](https://github.com/kestiny18/dsh-plugins/blob/main/CONTRIBUTING.md) | ||
| `Cost` appears only when every model call in that turn has provider usage and a matching configured rate. If either is missing, the token metrics remain visible and the cost segment is omitted; a partial amount is never presented as the turn total. | ||
| ## Web Usage page | ||
| Open **Settings → Usage** to inspect replay-derived accounting. The independent page starts in **All sessions** scope and provides: | ||
| - total, input, cache, and output tokens; | ||
| - model-call count and estimated cost; | ||
| - a keyboard-accessible 52-week UTC activity heatmap with per-day token buckets and cost; | ||
| - provider/model totals; | ||
| - per-session totals, or per-turn totals after choosing one session. | ||
| The page updates from Harness's global session projection feed. Its total cost displays `--` whenever pricing or provider usage is incomplete, with an explanatory coverage note. This page is intentionally independent from **Models**: Models configures providers, while Usage observes calls across all configured providers. | ||
| The heatmap color encodes total token volume relative to the busiest visible day. Hover, focus, or click a day to inspect its exact Input, Cache, Output, and Cost. Daily buckets use UTC so replay remains stable across browsers and machines; future cells in the current week stay blank. | ||
| The former `/cost` command is intentionally not registered: the Web footer and Usage page cover its information without adding command rows to conversation history. Rows created by older local builds remain part of their durable session logs, but no new `/cost` execution is available. | ||
| ## Accounting coverage | ||
| The projection is replay-derived and adds no new session event. It currently covers: | ||
| - ordinary agent-loop calls from `assistant/chunk` and `assistant/message` usage; | ||
| - successful compaction model calls from `compaction/summary` usage; | ||
| - model switches, price changes, cache reads, and cache writes; | ||
| - calls with reported usage but no configured price, shown as `unpriced`; | ||
| - entered agent steps and compactions without reported usage, shown as `without usage`. | ||
| Current Harness session-title LLM events record the request route but not provider usage, so title-generation fees cannot yet be reconstructed and are not included. Calls made by plugins that neither attach usage to an existing durable event nor use the agent loop are likewise outside the projection. A future Harness-wide usage event would remove this blind spot without changing the pricing model. | ||
| ## Why this differs from Noval | ||
| Noval's useful ideas are retained: provider-neutral usage, side-channel accounting, model/purpose summaries, and a compact 52-week activity view. Its `JsonlUsageStore` and metered client wrapper are not copied because Harness already owns a durable event log, replay projections, model routes, and Web extension slots. Reusing those seams avoids a second persistence format and keeps compaction, resume, and Web clients consistent. | ||
| ## Development | ||
| ```sh | ||
| pnpm install --frozen-lockfile | ||
| pnpm run check | ||
| pnpm run pack:check | ||
| ``` | ||
| See [CONTRIBUTING.md](../CONTRIBUTING.md) for source-checkout testing and pull-request expectations. | ||
| ## Automated releases | ||
| This monorepo publishes from GitHub Releases through npm [Trusted Publishing](https://docs.npmjs.com/trusted-publishers/); no npm write token is stored in GitHub. | ||
| After creating the GitHub repository and adding it as `origin`, run `pnpm repo:sync` from the monorepo root and commit the resulting package metadata. Then configure: | ||
| - a GitHub environment named `npm`; | ||
| - the npm package's GitHub Actions trusted publisher with this repository; | ||
| - workflow filename `publish.yml`; | ||
| - environment `npm`; | ||
| - allowed action `npm publish`. | ||
| To release, update the package version and changelog, run `pnpm --filter dsh-usage run release:check`, and publish a GitHub Release tagged exactly `dsh-usage-v<package-version>`. Normal releases use the npm `latest` tag; GitHub prereleases use `next`. | ||
| MIT licensed. |
Sorry, the diff of this file is too big to display
836618
0.66%95
4.4%70
-65.52%