Preface¶
When running long sessions in DSH Web, two metrics are usually hard to see directly: how much of the context window is occupied, and how much this session has cost so far. Token usage data is not lacking in itself—token-meter already provides session projections like tokenUsage, contextPressure, and contextBreakdown—what is missing is a panel on the interface to display them. As for cost, one has to manually look up unit prices and calculate based on peak and off-peak hours.
The following introduces the dsh-context-show plugin maintained by pureskywalk. It adds an occupancy indicator button to the DSH Web session header; clicking it opens a draggable panel that displays occupancy, composition, tool usage, cost, and usage by vendor in real-time.
What is this¶
dsh-context-show describes itself as a “DSH Web Client Plugin + Host Projection Plugin”: the browser handles the panel and settings interface, while the host registers the contextUsage session projection and aggregates usage from durable logs. Current version 0.9.0, license MIT, installed into the web profile.
It answers four questions:
- How much context is left — the occupancy percentage of
projectedTokens / contextWindow; - Where does occupancy come from — how much system prompts, tool definitions, and conversation messages occupy, and which tools are called the most;
- How much did it cost — estimated cumulative cost based on unit prices per million tokens, automatically distinguishing peak/off-peak based on the timestamp of each request;
- Who is the usage attributed to — cumulative usage attributed by provider/model route.
Core Features¶
Occupancy Indicator & Panel¶
- An occupancy indicator button (ring + percentage) appears on the right side of the session header; clicking it expands/collapses a draggable panel;
- The ring changes color based on occupancy level:
neutral (<70%),amber (70–89%),red (≥90%); - The panel stays visible; it can be closed by clicking the button again or pressing Escape; it can be dragged by holding the handle (⠿);
- There is a summary version and a detailed version; the summary version only shows occupancy and total cost;
- All values are pushed in real-time via the session projection
useProjection, and the tool list syncs when the conversation snapshot changes.
Source Composition & Tool Occupancy¶
The detailed version shows two details:
- Source Composition: Heuristic token composition of system prompts / tool definitions / conversation messages. Data comes from the
contextBreakdownprojection of token-meter, displayed as segmented progress bars + detail rows. - Tool Occupancy: A list of occupancy aggregated by tool name, showing call counts and approximate token counts, without displaying raw content.
Cost Estimation & Peak/Off-Peak Pricing¶
Cost is estimated based on configured unit prices (per million tokens, default CNY) and automatically applies peak/off-peak rates based on the timestamp of each request. Peak/off-peak pricing is enabled by default: peakHours: 9–12 / 14–18, timeZone: Asia/Shanghai. Weekends are automatically off-peak, with off-peak prices being half of peak prices. The plugin comes pre-configured with a price list based on the DeepSeek official pricing page (api-docs.deepseek.com/zh-cn/quick_start/pricing/), in CNY per million tokens:
| Model | Period | Cache Hit | Cache Miss | Output |
|---|---|---|---|---|
| deepseek-v4-flash | Off-peak | ¥0.05 | ¥1.5 | ¥4.5 |
| deepseek-v4-flash | Peak | ¥0.10 | ¥3.0 | ¥9.0 |
| deepseek-v4-pro | Off-peak | ¥0.15 | ¥4.5 | ¥13.5 |
| deepseek-v4-pro | Peak | ¥0.30 | ¥9.0 | ¥27.0 |
| deepseek-v4-flash-vision-exp | Same as flash | ¥0.05/0.10 | ¥1.5/3.0 | ¥4.5/9.0 |
The detailed version lists the amount for each model in descending order of cost, including supplier, official price link, and input/output token details.
Usage by Vendor¶
Cumulative usage attributed by provider/model route is obtained by the plugin’s built-in contextUsage session projection, which folds durable logs on the host side. This allows you to see exactly which routes the usage falls on.
Installation & Enablement¶
First, execute the installation command to add the plugin to the web profile:
dsh plugin --profile web add dsh-context-show
It also supports installation via local path (link) and Git in the form github:<owner>/<repo> (the usage in README is a placeholder template, replace with the actual repository address):
dsh plugin --profile web add "C:\path\to\dsh-context-show"
After installation, the target profile needs to be restarted, as both the host plugin and the client bundle require a restart. After that, you can see the occupancy button on the right side of the session header in DSH Web.
Two tips:
- If pnpm reports
ERR_PNPM_UNEXPECTED_STORE(the local store path differs from the profile), append--store-dir=<your pnpm store>to the add command; the store path can be queried withpnpm store path; - Prices saved in the settings page take effect immediately via the settings seam, no restart needed.
Where to configure unit prices¶
After the installation steps above, open DSH Web Settings → Plugins → Plugin Config, find the last card “Context Occupancy · Unit Price Config” (default collapsed, click the title to expand), and you can edit:
- Currency: CNY / USD / CNH / EUR / GBP / JPY;
- Peak/off-peak pricing toggle; once enabled, you can change peak hours and time zone;
- Default price (fallback price when no vendor is configured);
- Vendor unit prices and model-level overrides (
provider/model).
Saving takes effect immediately; “Restore Defaults” clears the user layer and reverts to bundle defaults.
If you don’t use the settings page, you can also edit the patch configuration directly; priority increases from top to bottom:
- Plugin defaults:
dsh-context-show/cordis.patch.yml(distributed with the plugin); - Profile user layer:
$DSH_HOME/profiles/web/cordis.patch.yml; $DSH_HOME/cordis.patch.ymland the command line--patch.
The lower layer overwrites the entire line of config in the upper layer.
Version Alignment & Dependencies¶
- The plugin currently aligns with DeepSeek Harness
0.1.1-rc.2: thecontextUsageprojection is registered asstateSchema+wirevia the new API. Host versions0.1.0-rc.7and earlier lack this wire view; the host needs to be upgraded to display amounts. - For host-apiproxy in
0.1.0-rc.6hosts, only official setting namespaces are allowed. Therefore, the plugin registers a pair of loopback, POST-only bridge routes/api/dsh-context-show/settings/describe|mutateon the host side as a fallback for settings read/write; once the host allows third-party namespaces, the official scope automatically takes the main path. - Runtime dependencies:
@deepseek-ai/dsh-token-meter(providestokenUsage/contextPressure/contextBreakdownprojections),@deepseek-ai/dsh-settings(built-in indsh-basebundle), and the host-side webServer service. When the host half of this plugin is missing, the panel degrades to only showing projections already available in token-meter; when token-meter is missing, an empty state is displayed.
Development & Verification¶
When developing from source, the workflow is:
pnpm install
pnpm typecheck
pnpm test
pnpm build
pnpm verify
pnpm verify executes typecheck, test, and build in sequence. The build artifact lib/ can be loaded directly by the profile via path/link without needing the install script.
Use Cases & Notes¶
Suitable for these scenarios: using DSH Web for daily development with long sessions and wanting to monitor context pressure; concerned about session costs, especially peak/off-peak differences; connected to multiple providers/models and wanting to see usage distribution after route attribution.
A few notes:
- Occupancy and source composition are heuristic estimates; cost is estimated based on configured unit prices; neither equals the supplier’s bill;
- The plugin runs with the permissions of the current dsh process; it is recommended to check the source code and confirm the license (this project is MIT) before installing;
- Full panel functionality depends on token-meter and the host-side plugin; if missing, it degrades or shows an empty state as described in the previous section.
Summary¶
dsh-context-show does not do anything complex: it aggregates existing session projections in DSH Web into a draggable panel, and makes unit price configuration an editable form. For those who need to keep an eye on the context window and cost, it saves the steps of sifting through logs and manual calculation.
- Plugin directory page: https://www.skillhub.cn/plugins/pureskywalk/dsh-context-show
- GitHub repository: https://github.com/pureskywalk/dsh-context-show
skillhub.cn is a community-maintained plugin directory with no official affiliation with DeepSeek or Hanxin AI. The design philosophy of DSH is “everything is a plugin,” and such panels are precisely the form of community extension in this ecosystem.