dshbase

插件目录 / Developer / dsh-cost-tracker

dsh-cost-tracker

已验证 · 实测可装 yflmq001

✓ 持续维护 基于 14 个官方 DSH 包 纯 TypeScript

查看 GitHub ↗ ← 返回插件目录

3Stars
0Forks
0未关闭 issue
TypeScript语言
2026-08-14最近推送
跨平台平台

功能简介

DeepSeek Harness 令牌成本追踪

✅
我们的评价
可用 — 实测通过,早期项目

DeepSeek Harness 令牌成本追踪 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

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.

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).

- name: 'dsh-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.

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-cost-tracker」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

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

Headless(CLI)profile:

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

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

使用场景

扩展 agent 的编码能力面——给它一个新工具、工作流或集成,让它接手以前做不了的开发任务。

适合谁

想让 dsh 在真实代码库上像队友一样干活的开发者——能改、能跑、能验证,而不只是回答问题。

二次开发建议

工具/命令面就是缝:暴露更多 SDK 能力、加更聪明的上下文接线,或收紧改代码与验证之间的循环。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7797 个插件 →