In DeepSeek Harness (DSH), session consumption, cost attribution for delegation chains, and peak-period pricing strategies are key information that developers and administrators need to clarify. dsh-api-cost aims to provide precise cost estimation capabilities for DSH, support distinguishing peak and off-peak rates, and attribute delegated or team spending to the specific session that triggered the spend.
This is a DeepSeek cost estimation plugin that supports peak/off-peak rates, delegated or team cost attribution, and collapsed calculations based on host session projections. It is maintained by NIRVANA-APOC, belongs to the admin-security category, and is released under the MIT open source license.
Core Features¶
- Rate distinction: Supports distinguishing peak and off-peak rate periods.
- Cost attribution: Attributes delegated or team spending to the session that triggered the spending.
- Session projections: Calculates based on host session projection data.
- Visual components: Provides Composer Pill and cost panel.
- Peak avoidance: Provides an “Avoid Peak” switch to suspend requests until the off-peak period.
- CLI tools: Provides the
/costcommand andsession_costtool. - Data reading: Supports reading via HTTP.
Installation and Enablement¶
Use the official installation command to add the plugin to the web configuration file:
dsh plugin --profile web add dsh-api-cost
After installation, DSH needs to be restarted because client components need to be reassembled for the changes to take effect.
Typical Usage¶
1. View Cost Overview¶
In the UI, the plugin provides two display modes:
- Composer Pill: Displays the estimated cost and effective rate period (peak/off-peak) for the current session. Click the Pill to open the detailed panel.
- Cost panel: Clicking the Pill (or pressing Enter) opens a panel containing:
- Total amount, allocation between this session and other sessions
- Peak and off-peak allocation
- Number of priced calls and coverage
- Current rate
- Countdown to the next rate period change
- Avoid Peak switch
2. Command-Line Query¶
Use the /cost command to print the same summary as the Pill in the terminal, including coverage warnings:
/cost [sessionId] [auto|self|tree|team]
Use the session_cost tool to allow the assistant to read the estimate for a given session. It defaults to the calling session.
3. Scope Notes¶
Commands and the panel support the following scopes:
auto(default): Validated if the session belongs to a team; otherwise uses the delegation tree.self: Current session only.tree: Current session and all its persisted sub-agents.team: Entire team (member relationship validation required).
Applicability and Notes¶
This plugin requires DeepSeek Harness version 0.2.0-rc.2 and the sessionProjections, sessionProjectionCache, and sessionQuery capabilities to be mounted (both the web and desktop configuration profiles include these by default).
For development environments, building from source requires Node.js 24 or later; the published package includes precompiled JavaScript and does not require local compilation.
Important limitation: The “Avoid Peak” switch depends on an LLM service. Without an LLM service, the switch cannot suspend requests. Additionally, Token bucket and per-model detailed breakdowns are available only via /cost, session_cost, and HTTP reads; they are not displayed in the panel.
Summary¶
dsh-api-cost provides DSH with fine-grained cost management capabilities from the session level to the team level. Through the intuitive Pill and panel, combined with command-line tools, you can clearly track spending attribution and rate-period pricing. For more details and source code, refer to the directory page or GitHub repository below.