AllDSH
中文

TokenLedger

zh667 · zh667/TokenLedger

Token-usage accounting attributed to the relay site, project and model that actually served each request, with zero configuration.

TokenLedger is a DSH plugin by zh667. Token-usage accounting attributed to the relay site, project and model that actually served each request, with zero configuration. It is filed under Tools & Capabilities and Integrations & Connections. Verification level L3 (Install spec), an automated security scan has not run yet, and it targets DeepSeek Harness >=0.1.0-rc.6; the listing was last checked on 2026-09-18 and is published under the MIT licence. Install it with dsh plugin --profile web add "github:zh667/TokenLedger"

Listing checked by Chiyu , data updated · How to cite

L3active
TokenLedger verification panel: level L3 of 5 (Install spec) — Install command parsed, DSH target declared. Security scan: unverified — no scan has run. Compatibility target: DeepSeek Harness >=0.1.0-rc.6. Licence: MIT. GitHub stars: 201. Listing last checked 2026-09-18.
Verification panel for TokenLedger. The listing holds level L3 of 5 — Install spec: Install command parsed, DSH target declared. Security scan: unverified — no scan has run. Compatibility target: DeepSeek Harness >=0.1.0-rc.6. Licence: MIT. Listing last checked 2026-09-18. How verification works

In use

Screenshots taken by this directory of the plugin running in a throwaway DeepSeek Harness on a generated demo project — not of your own machine, and not supplied by the author. Click any capture for the full-size version.

TokenLedger — Installed and enabled, as the expanded row in Settings → Plugins → Plugin list: full package name, configuration state and runtime state.
Installed and enabled, as the expanded row in Settings → Plugins → Plugin list: full package name, configuration state and runtime state.
TokenLedger — A real session that ran one short task on a generated demo project.
A real session that ran one short task on a generated demo project.

Captured by AllDSH on 2026-09-19 against DSH 0.1.5-rc.1 at a 1920×1080 viewport, package github:zh667/TokenLedger@github:zh667/TokenLedger.

Install command

dsh plugin --profile web add "github:zh667/TokenLedger"

Requires a running harness: start it withnpx @deepseek-ai/dsh webthen run the command above.New to this? See the installation guide.

What it does

TokenLedger answers a question most usage panels get wrong: not just how many tokens you burned, but which relay site actually served the request. It groups usage by the normalized origin of each provider’s baseURL — so several keys on the same site collapse into one row named by its domain, not by whatever alias you gave the route — and again by project and by model.

The pitch is zero configuration: it discovers relay sites from the host’s own provider settings, reading only the baseURL and never the credential sitting next to it. A sidebar panel (「用量账本」) in the Web GUI shows the result; the /tokenledger command family answers the same questions from the chat, reading the same queries with no second aggregation.

What the panel shows

  • Three windows — today / this month / all time, with drill-downs by site and by model, a cache-hit rate, and a one-year activity heatmap whose hover shows that day’s model mix.
  • Balances — DeepSeek official, the New API family (One API, VoAPI and other forks), Sub2API, Moonshot/Kimi and Z.ai/GLM, each read with the ordinary API key already configured on the route. OpenRouter is the exception: its credits endpoint only accepts a Management Key, and the panel says so instead of leaving you a bare 401.
  • Subscription quotas — for plan-sellers with no balance to read (OpenCode Go, Kimi For Coding, MiniMax Coding Plan, Z.ai Coding Plan, and Sub2API’s plan variants): each rolling window — 5-hour / daily / weekly / monthly — gets a progress bar, a percentage and a reset time. A wallet and a plan can coexist (Z.ai has both) and are read independently.
  • Cost estimation — a configurable rate table with effective-date segmentation, bucketed pricing and peak/off-peak windows. Unpriced models show a dash, not a guessed 0.
  • Export and diagnostics — CSV/JSON export, index health, and a count of rows that could not be attributed, listed separately rather than silently bucketed.

Sessions are attributed by the directory they were started in — not by workspace id — so sessions launched in subdirectories still count; sessions with no recorded cwd get their own “未记录目录” row instead of being dropped, which keeps the per-project rows summing to the total.

Privacy architecture

This is the part the README engineers most carefully, and it deserves its own read:

  • Content is never read. Only counts and identifiers: token numbers, model names, provider route names, site domains. Prompts, tool arguments and response bodies are neither read nor stored.
  • Credentials stay host-side. Keys are resolved per request from the host’s credentials service by apiKeyEnv reference, discarded after use, and travel only in the Authorization header — never in a URL query string. The browser never receives a key.
  • Loopback lockdown. The two HTTP endpoints (/api/tokenledger/usage, /api/tokenledger/balance) are registered as exact routes, putting them outside the RPC trust boundary; their handlers reject non-GET methods and validate both the peer socket address (not spoofable) and the Host header.
  • User-declared endpoints are bounded in code, not by convention. You can declare a balance endpoint for an uncovered provider, but the request can only go to the origin of an already-configured provider; the path must be absolute with a single leading slash and is re-validated after construction; only GET is ever sent; credentials still come only from that provider’s own apiKeyEnv; cross-origin redirects fail closed; responses are size-capped and time-limited; and declared endpoints cannot override the built-in readers.
  • Relay fingerprinting needs no credentials — it works off the route’s 404/401 signatures, probed once and remembered.

Requirements

  • A web profile of DeepSeek Harness. The README requires @deepseek-ai/dsh >= 0.1.0-rc.6, and the badge agrees. Note the basis: the package manifest declares no dsh.compatibility block and no engines.dsh, so that floor comes from the README alone, not from machine-checked metadata.
  • Node >=22, per engines.
  • The client platform is web, injecting dsh-client-locale and dsh-client-ui-primitives; the browser half has no build step (a hand-written __ModuleLoader__ bundle with React provided by the host). Peer dependencies are @deepseek-ai/cordis ^4.0.2 and an optional @deepseek-ai/schemastery. No install-time lifecycle scripts — package.json carries only test scripts.
  • The same package also ships a Blue-host manifest (blue.plugin.json): on a Blue host it mounts a native dashboard and overlay commands instead of the text command; on a plain Harness/Web install none of that activates.
  • The README is Chinese-first; panel copy follows suit.

Known limits

  • Install source divergence. The README installs from GitHub (github:zh667/TokenLedger, repo version 0.1.1-blue.0 at collection time); the npm registry also carries dsh-tokenledger, but its published release lagged the repository. Follow the README’s GitHub spec — it is the path the author tests.
  • Pinning needs a full 40-character commit SHA. The README’s spec table shows short SHAs fail with Could not resolve, because the package manager matches refs against git ls-remote.
  • Subscription endpoints have no public schema. When a vendor moves a field, the card tells you where it looked — but the number is absent until the adapter catches up.
  • 「未知路由」 rows mean the serving route is no longer in your provider config (renamed, deleted, or from another machine). The data is not lost — the route name is stored — and re-adding the route under the same name re-attributes history on the next reindex.
  • Days are split in the host’s local timezone (the panel labels which).
  • Cost figures are estimates from your rate table; nothing here is a bill.
  • Attribution is frozen into records at fold time and history is never rewritten — changing the relay set drops the index and rebuilds it from scratch.

When to use it — and when not to

Use it if your traffic runs through one or more relay sites and you want to know which site, project and model actually burned the tokens — with balances and subscription windows in the same panel, and without handing the panel your keys. The declared-endpoint escape hatch makes it usable even with providers the built-in table does not cover.

Do not install it expecting enforcement: it observes and reports, it does not block or throttle anything. Skip it on headless or CLI-only setups (the panel is Web GUI), and think twice if you are unwilling to let a plugin read your provider baseURL list at all — that read is the discovery mechanism, and there is no offline mode.

Install

Per the README, from GitHub:

dsh plugin --profile web add "github:zh667/TokenLedger"

Then fully restart the running dsh web and hard-refresh the browser; the 「用量账本」 entry appears at the bottom of the sidebar. Run /tokenledger diagnostics after install if a relay site you expected does not show — it prints the current route attribution against the index.

Sources & references

The technical claims on this page rest on the primary documents below. Each link is followed so it can be checked directly.

  1. [1]zh667/TokenLedger — GitHubThe plugin’s own repository and README — the primary document every claim in this listing is checked against.
  2. [2]deepseek-ai/deepseek-harness — GitHubUpstream repository for DeepSeek Harness, the Cordis runtime and the plugin loading model.
  3. [3]@deepseek-ai/dsh on npm — npmPublished harness package, including the release tags our dshTarget field tracks.
  4. [4]dsh-plugin GitHub topic — GitHubThe discovery mechanism used to find plugins listed in this directory.

All links last verified 2026-09-11

Questions about this listing

Is TokenLedger safe to install?
TokenLedger holds verification level L3 of 5 — Install command parsed, DSH target declared — and its security status is unverified — no scan has run. A verification level records how far the install path was exercised; it is not a safety guarantee. Safety depends on what the plugin can actually reach, so read its source and install script and check its file, shell, network and credential access before you run it.
Which DeepSeek Harness version does TokenLedger target?
TokenLedger declares dshTarget >=0.1.0-rc.6, the DeepSeek Harness release this listing was checked against. dshTarget is the compatibility target the plugin author declares: it records that a release was checked, not that the plugin keeps working after upstream ships something new. Test in an isolated profile before upgrading your harness.
How do I install TokenLedger?
Start the harness with npx @deepseek-ai/dsh web, then copy the install command shown at the top of this page. That command is generated from the package name the repository publishes — or from an install spec the listing declares — so it cannot drift from what the repository actually ships. This listing was last checked on 2026-09-18.

Similar DSH plugins

Browse all

Four recomposable controls in the composer — working state, reasoning strategy, quality gate, and a self-evolution loop that proposes rules but never applies one without your review.

L3
199 TypeScript

SeekTTY

Hilbert-beinghappy

A Claude Code-style terminal workspace on the dsh Host — streaming markdown, TextMate highlighting, session and provider centers.

L3
198 TypeScript

API Relay Audit

toby-bridges

A DSH plugin that runs a local 14-step audit against an AI API relay, reusing the current provider's endpoint and credential.

L3
838 Python

treg

superdesigndev

A credential-injecting proxy and shared tool registry: one token reaches 3,000+ catalogued endpoints, and keys stay on the server.

L2
1.6k Python

A Chrome/Firefox sidebar extension that gives DSH a text-only channel into your own browser tabs — no vision model required.

L3
684 TypeScript

EasyEDA Agent

zhoushoujianwork

Hands for your AI harness on EasyEDA Pro — typed schematic/PCB actions via Go CLI, Agent Skill, and stdio MCP, with a circuit-block library.

L2
465 Go
ESC

Type to search the index. Built at deploy time by Pagefind.