sjh9714/dsh-lean0

dsh-lean

DeepSeek bills peak hours at 2x, and peak is 09-12 and 14-18 Beijing time. npx dsh-lean audit shows what your session paid and what it costs off-peak. DeepSeek 峰时按 2 倍计费,峰时正好是上班时间。

包名
dsh-lean
版本
0.8.0
许可证
MIT
最近更新
2026年8月17日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:sjh9714/dsh-lean

English | 简体中文

dsh-lean

npm prefix peak cost runs license

DeepSeek started charging double at peak hours on 2026-08-16, and peak is the working day.

Peak is 01:00-04:00 and 06:00-10:00 UTC. Off-peak is every other hour at exactly half.

your clockpeak hours, billed at 2x
UTC+8 Beijing, Shanghai, Singapore09:00-12:00 and 14:00-18:00
UTC+9 Tokyo, Seoul10:00-13:00 and 15:00-19:00
UTC+0 London01:00-04:00 and 06:00-10:00

If you work Asian hours, nearly every line of code you write is billed at the expensive rate, with a gap at lunch. Moving a long run to the evening halves its bill and changes no configuration. Nothing else in a session is a 2x lever.

See what your own last session actually paid, and what it would have cost off-peak. Nothing is installed and nothing leaves your machine.

npx dsh-lean audit
  ran 08:42 to 08:42 UTC
  3 of 3 requests hit peak hours (01-04 and 06-10 UTC), 100% of the tokens
  you paid             $0.000951
  same run off-peak    $0.000476    remove dsh-lean`. On the web profile that leaves the authored preset behind; delete `$DSH_HOME/.agent-presets/lean` to remove it too.

### The two profiles work differently, and that matters

The headless profile mounts its tools as top-level rows, so a bundle patch turns them off directly.

The web profile does not. Its bundle already disables those rows at the top level and then mounts `agent-presets`, with the real catalog living inside the `standard` preset composition. **A patch layer cannot reach inside a preset composition.** So on the web profile this package instead copies `standard` through dsh's own `agentPresets.copy()` authoring API and disables the delegation group, the goal tool and the jobs tool in the copy. The copy is made from whatever `standard` you actually have, so a dsh upgrade is inherited rather than diverging from a vendored fork.

It does not change your default preset. A default pointing at a preset that failed to author fails loud at mount time, which would break the profile over a convenience. "Lean" appears in the mode menu and you pick it.

Measured on the web profile, same prompt and same workspace, one session each.

| | tools | system prompt | tool schemas | prefix |
|---|---|---|---|---|
| Standard mode | 25 | 6,100 chars | 26,336 chars | 32,436 chars |
| Lean | 12 | 3,492 chars | 11,842 chars | **15,334 chars** |

That is a 52.7% cut, the same as the headless figure. The cost table above was measured on headless, where the benchmark harness can drive a task end to end; the web numbers here are the prefix only.

## What it turns off

`tool-workflow`, `tool-subagent`, `tool-subagent-fork`, `tool-subagent-control`, `tool-subagent-list-agents`, `tool-goal`, `tool-jobs`, `tool-ralph`.

What stays is the set a coding session actually uses. `bash`, `read`, `write`, `edit`, `glob`, `grep`, `str_replace_editor`, `todo_write`, `skill`, `read_image`, `web_search`, `exit_plan_mode`.

Only tool rows are disabled. The services behind them stay mounted, so anything that injects them still resolves.

## When not to use this

Do not install it if you use subagents, workflows, the goal system, background jobs, or the ralph loop. Those are exactly what it removes, and the agent will tell you it has no such tool.

Two more honest limits.

- **The saving is diluted by output, not by session length.** It removes a fixed amount, roughly 3,700 cache-miss tokens, from the front of each session, and whatever else the session spends dilutes that. Output is the biggest diluter, billed at 3x the cache-miss rate. The 3-request question saves 41% and the 4-request implementation task saves 2%, so request count is not the variable, output volume is.
- **The percentage does not grow on the expensive model.** `deepseek-v4-pro` costs 3x flash across the board, so it buys 3x the absolute saving and the same percentage. Measured, pro saved 20% against flash's 23% on the same task. Under the old flat card pro had a 120x miss to hit ratio against flash's 50x, which looked like a reason to expect more; it was not, and the new card removes even the appearance by putting both models at about 30x.

## Reproduce it

You need a DeepSeek API key and Node 18 or newer.

```sh
git clone https://github.com/sjh9714/dsh-lean
cd dsh-lean

# keep the benchmark away from your personal dsh config
export DSH_HOME="$PWD/.bench-home"
mkdir -p "$DSH_HOME"
cp ~/.dsh/.credentials.yaml "$DSH_HOME/"

node scripts/run-bench.mjs bench/task-01                             # default
node scripts/run-bench.mjs bench/task-01 --patch cordis.patch.yml    # dsh-lean
node scripts/summarize.mjs

# the v4-pro row, same tasks on the expensive model
node scripts/run-bench.mjs bench/task-01 --patch bench/pro.patch.yml
node scripts/run-bench.mjs bench/task-01 --patch bench/pro.patch.yml --patch cordis.patch.yml

Each run copies the task to a fresh workspace, runs it through dsh --profile headless, verifies the deliverable with the task's own npm test, then reads the token counts back out of the session log. Raw results for every run in the table are committed under bench/results/.

npx dsh-lean audit prints the same breakdown for any dsh session you already ran, and npx dsh-lean audit --all picks your most recent session anywhere.

How the measurement works

dsh writes a session.jsonl.zstd per run under $DSH_HOME/sessions. Two event types carry everything needed.

  • assistant/chunk with chunk.type of usage carries the provider's own inputTokens, cacheReadTokens, outputTokens and reasoningTokens for each request.
  • request/header carries the complete tool schema array and system prompt that were sent, which is how the prefix sizes above were measured without spending an extra API call.

@deepseek-ai/dsh-llm-deepseek already separates DeepSeek's prompt_cache_hit_tokens from prompt_cache_miss_tokens before recording them, so the cache split is the provider's number rather than an estimate.

License

MIT