A DeepSeek Harness Web plugin that shows cumulative provider token usage for the active conversation beneath the composer.
It renders three values:
总输入 12.3K · 总输出 4.5K · 合计 16.8K
Click the strip to open a detail panel with uncached-input, cache-read, cache-write, and output totals. The same panel lets each user choose whether 总输入, 总输出, and 合计 appear in the strip. Choices are local to the current browser plugin run and reset when the plugin stops or restarts.
The plugin is client-only. It reads the built-in tokenUsage session projection through the conversation.composer.dock slot's useProjection prop, so it adds no Host RPC, persistence, or token estimation.
tokenUsage is the provider-reported cumulative usage for the entire durable session log. Prompt-side total is the sum of uncached input, cache reads, and cache writes. Completion total is output tokens. Reasoning tokens are already included in output tokens.
The plugin applies to the active conversation only. It does not aggregate across sessions or estimate cost.
This repository is a reusable source template for a dynamic Cordis plugin. In a DSH Web session with the Cordis tools enabled, ask the agent to create 显示总的用量 from the clientCode() implementation in this repository, or submit this definition after loading the module:
import { clientCode } from 'dsh-total-usage'
const definition = {
plugin: { kind: 'new', idPrefix: 'tusage' },
name: '显示总的用量',
purpose: '在当前会话输入框下方显示累计输入、输出和总 Token 用量。',
code: { client: clientCode() },
}Then run the returned plugin and package IDs. The Web client asks for approval before loading the client code.
The client code registers total-usage as an additional conversation.composer.dock entry after DSH's built-in stats entry. It is removed automatically when the dynamic plugin stops.
Use this prompt when creating the plugin through a DSH coding agent:
Create a client-only Cordis plugin named 显示总的用量. Register an additive
conversation.composer.dock entry with id total-usage after the built-in stats
entry. Read useProjection('tokenUsage'), display cumulative total input, total
output, and total tokens, and put uncached input, cache read, cache write, and
output totals in the hover text. Do not add a Host RPC, persistence, cost
estimation, or cross-session aggregation.
The terms DeepSeek Harness, DSH, Cordis, tokenUsage, and
conversation.composer.dock intentionally appear here so users and coding
agents can find the supported integration points quickly.
npm testRequires a DeepSeek Harness Web composition that provides:
- the
conversation.composer.dockslot; - the
tokenUsagesession projection; - the Cordis client runner, when using the dynamic definition flow.
MIT