rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:yinmyu/dsh-costops-hub
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A token cost ledger for DeepSeek Harness.
Every settled request priced at the official list price that applied when it ran:
money not spent on a local route, money spent in the cloud, and the net between them.
简体中文 · English

A local model feels free because no invoice arrives. It is not free: it costs electricity, hardware, and the time you waited. What it does save is the API bill you would have paid for the same tokens.
CostOps Hub answers one question with a ledger instead of a guess: how much money did my local routes actually save me, how much did the cloud routes actually cost, and what is the net?
The bill page is the main surface; the composer pill is the live one.
The pill — one claim for the session you are in: saved ¥5.51, spent ¥0.72, or both. |
Its breakdown — the model, the price window, and where the money went. |
Ask which session — open any model and see the sessions that contributed, by amount. |
This session — the same three numbers for one conversation, and a way back. |
Route rules — which providers are local, which models are exceptions, whether sub-agents count. |
It folds — the summary bar stacks, the provider column drops out, the toolbar wraps. |
flowchart LR
A["Session logs<br/>~/.dsh/sessions/**"] -->|ctx.sessionQuery| B["Ledger<br/>facts only: when, who, which tokens"]
B -->|"GET /plugins/local-savings/api"| C["Bill page<br/>prices + buckets + rules"]
D["Route rules<br/>plugin config"] --> C
E["Pricing table<br/>in client.js"] --> C
ctx.sessionQuery (it owns zstd
decoding, format migration and replay validation). Each settled assistant/message carries its
provider, model and token usage, so attribution is exact per request, not per session.[time, session, seq, provider, model, uncached input, cache read, cache write, output]. Forks are de-duplicated (inheritedEventCount), live sessions
are re-read at most once a minute, and a scan stops at a wall-clock budget so the app never
freezes — the page shows progress instead.| Stored | Not stored |
|---|---|
| Timestamp, session id, event seq | Money, currency, exchange rate |
| Provider id, model id | Peak / off-peak verdict |
| Uncached input, cache read, cache write, output tokens | "Local or cloud" verdict, price tier |
The first open backfills the last 32 days of session logs, newest first, a few seconds at a time,
and reports reading history 12/49 sessions… while it does. Once covered, a session is only re-read
when its log changed.
CostOps Hub is a DeepSeek Harness bundle — a package with a dsh.bundle.patch that inserts its
Host row and a browser module. Nothing else is required: no npm dependencies, no build step.
From a checkout
plugin_manager tool using the absolute path.From the repository URL
Use the same plugin_manager install flow with the repository address instead of a path.
The Host half is loaded once per plugin process. After changing
index.js, reload the plugin row (disable and enable it in Plugins) — a browser reload alone is not enough.
| Window | What it contains |
|---|---|
| This session | The conversation in front of you, and a link back to it after you drill elsewhere |
| Last hour | The last 60 minutes, in 5-minute buckets |
| Today | Beijing midnight to now, hourly buckets |
| Last 7 days | Seven Beijing days, one bucket per day |
| Last 30 days | Thirty days, the widest window the ledger keeps |
Every number carries a comparison chip against the previous equal window (this morning against
yesterday morning, this week against the week before). Saving more reads blue, spending more reads
amber; a window with no history says new instead of inventing a percentage.
The second tab decides what counts as local: per-provider verdicts (auto / local / cloud), model exceptions (one provider can serve both worlds), and whether sub-agent sessions are included. Rules change the verdict, never the facts — history is recalculated immediately.
The composer pill is the live surface: it reads the session's own projections and trajectory, prices
each request when it ran, and reports saved, spent, or both. Click it for the breakdown.
Prices are per 1,000,000 tokens, taken on 2026-11-11 from official vendor pages. Machine-readable
data and per-tier notes live in docs/pricing-source.json and
docs/pricing-research.md; every surface states the date.
| Vendor | Covered | Notes |
|---|---|---|
| DeepSeek | deepseek-flash ≈ DeepSeek-V4.1-Flash-1017, deepseek-v4-pro |
CNY; peak 09:00–12:00 and 14:00–18:00 Beijing time, 50% off outside |
| Zhipu | GLM-5.3 / 5.3-Flash / 5.3-FlashX / GLM-5.x / GLM-4.x | CNY; approximated tiers are labelled |
| Alibaba | qwen3.8-27b (Beijing list price), qwen3.8-max, qwen3.8-flash |
USD list prices converted at 1:6.67 |
| Moonshot | Kimi | official page publishes no machine-readable price — tokens only |
Known limits, all surfaced in the UI rather than hidden:
-Instruct, -AWQ, -EXL3, -GGUF, -FP8, -4bit …) so a
quantised artifact is priced as its official tier without an approximation notice.Route rules live in this plugin's row of the profile patch, so they travel with the profile and are visible to the Settings/Plugins surface:
- id: local-savings
name: "@local/dsh-local-savings"
config:
version: 1
includeSubagents: true
providers:
local: local
deepseek-official: cloud
models:
qwen3.8-27b: local
A profile without configEditor (headless runs) falls back to
<DSH_HOME>/storages/local-savings/rules.v1.json; both reads and writes report which source was
used, and the page states it.
| Item | Location |
|---|---|
| Session logs (read only) | <DSH_HOME>/sessions/** |
| Ledger | <DSH_HOME>/storages/local-savings/facts.v1.json |
| Exported CSV | <DSH_HOME>/storages/local-savings/exports/ |
| Route rules | the profile's cordis.patch.yml |
The plugin makes no network requests. It has no telemetry, no accounts, no proxy. The only data it sends anywhere is the JSON it serves to its own page over the harness's loopback HTTP server. If you delete the ledger file, the next open rebuilds it from the session logs.
conversation.composer.dock,
sidebar.panellist and main slots, and the sessionQuery / webServer / configEditor Host
services).configEditor the rules fall back to a side
file; without sessionQuery the page reports that history cannot be read.Everything is plain JavaScript — no dependencies, no bundler, no TypeScript step.
node --check index.js && node --check client.js
node tools/host-smoke.mjs # 12 Host: ledger folding, forks, coverage, export bounds
node tools/host-config-smoke.mjs # 4 Host: row config ↔ rules, editor round-trip, fallback
node tools/test-client.mjs # 106 Client: pill, page, windows, drills, readouts, degradation
node tools/detail-check.mjs # 6 Plugin Manager detail resources
node tools/live-log-check.mjs 3 # real session logs through the real route
The suites run without DeepSeek Harness: a fake Cordis context drives the Host half, and a small React shim with a hook store renders the browser half. CI runs the first four on every push.
| File | Role |
|---|---|
index.js |
Host half: ledger, rules, one HTTP route |
client.js |
Browser half: the pill and the bill page |
cordis.patch.yml |
Bundle patch that inserts the Host row |
locale/ |
Plugin Manager title, description and detail document |
tools/ |
Test suites and the detail-resource check |
docs/client-api-findings.md |
What each shipped API actually does, verified against a live build |
MIT © 2026 Ivan Yin.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: llm-pricing、local-llm、deepseek-harness。