DeepSHPlugins
dsh-cost-tracker 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-cost-tracker

安全與運維TypeScriptMIT

按模型追蹤 token 成本:可配置快取命中/未命中、輸出與高峰時段單價,實時會話花費條,並標記未配置價格的模型。

2 Starsyflmq001 更新時間 2026-08-26
訪問 GitHub 倉庫
dsh-cost-tracker 專案預覽

專案介紹

中文

按模型追蹤 token 成本:可配置快取命中/未命中、輸出與高峰時段單價,實時會話花費條,並標記未配置價格的模型。

English

Per-model token cost tracking with configurable cache-hit/miss, output and peak-window pricing, a live session cost bar, and unconfigured-model flags.

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
yflmq001
倉庫
yflmq001/dsh-cost-tracker
GitHub Stars
2
Forks
0
開發語言
TypeScript
許可證
MIT
最近推送
2026-08-26
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

57/ 100
維護活躍
90
文件與實用資訊
85
生態關注度
14
安裝便捷訊號
100
專案宣告訊號
100

近 16 天仍在更新;README 含完整安裝與使用說明;關注度尚低(2)。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin --profile web add github:yflmq001/dsh-cost-tracker

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

dsh-cost-tracker

🇨🇳 中文说明

awesome · DSH plugin

Token cost tracking for DeepSeek Harness, with per-model configurable pricing and peak/off-peak rates.

dsh-cost-tracker: per-session cost bar and the /cost command

What it does

  • Prices every finalized LLM call (assistant/message usage) against a

per-model pricing table you configure — cache-hit / cache-miss input, output, and optional peak-window rates.

  • Publishes a per-session cost projection (total / peak / off-peak / per-model),

consumed by the Web UI to show a live session cost readout.

  • Flags calls that land in a configured peak window.
  • Models without a pricing entry are surfaced as "unconfigured" with a

placeholder, so you know to add them.

Installation

Install into a dsh profile straight from GitHub — the plugin ships a dsh.bundle layer, so dsh plugin add enables it automatically:

dsh plugin --profile web add github:yflmq001/dsh-cost-tracker

Pricing starts empty (models: {}); fill in your models under the plugin's config (see below). To override defaults, add a cost-tracker row to the profile's own cordis.patch.yml — later layers win by row id.

⚠️ When overriding, address the row by its id (cost-tracker), not by
name. Cordis non-insert patches locate the target line by id; a name-keyed
override row is silently dropped, leaving prices at models: {}.

The cross-session bill persists through dsh's storage domain; a profile without a storage backend keeps the bill in memory only.

Configuration

Pricing lives under the plugin's config (Schemastery-validated). All prices are currency units per million tokens; you fill them in manually (no scraping).

- id: cost-tracker
  config:
    models:
      deepseek-v4-flash:
        inputMiss: 1.0        # cache-miss input
        inputHit: 0.02        # cache-hit input (omit if no cache tier)
        output: 2.0
        peak:                 # peak tier: hours + toggle + prices
          hours: ["09:00-12:00", "14:00-18:00"]   # Beijing time
          enabled: true       # false = peak off (base rates always); omit = on
          inputMiss: 3.0
          inputHit: 0.10
          output: 9.0
      gpt-4o:                 # any model the harness can reach
        inputMiss: 2.5
        output: 10.0

Session projection

The plugin registers the cost projection:

{
  totalCost, peakCost, offpeakCost,
  callCount, unconfiguredCalls, unconfiguredModels,
  byModel: { [model]: { inputHit, inputMiss, output, total } },
}

Cache writes are priced at the miss rate (providers bill the write at the miss tier; the written tokens become cache hits on a later call).

Billing correctness

Two choices keep the numbers honest:

  • Cache writes are billed at the miss rate, not the hit rate. Providers

charge cache writes at the cache-miss input tier (e.g. DeepSeek $0.14/M vs $0.0028/M hit) — pricing a write as a hit undercounts by ~50x whenever a session writes fresh context. Some cost plugins fold cache writes into the hit bucket; this plugin does not.

  • Unknown models are never silently priced. A model with no pricing entry

is surfaced as "unconfigured" with a placeholder in the projection and UI, so a guessed default can't hide in your bill. You add the price, or you see the gap.

Known Limitations and Deferred Work

  • Per-session cost is a projection over the durable log (replayed); the

cross-session global bill and /cost command are available.

  • Non-DeepSeek models need their pricing filled in manually; there is no

automatic price lookup.

  • Developer preview: assistant/message.usage is absent when the adapter

reports no accounting, and the session format has no compatibility promise.

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案