DeepSeek Harness (DSH) uses a plugin-based architecture. When developing or debugging agents, developers often find it difficult to intuitively track the actual cost of a single conversation or a long session. The dsh-session-cost plugin aims to solve this problem by calculating and displaying the current session cost in real time, helping developers better control costs.

This is a Web client plugin maintained by dog-lin. Its main function is to display the current session cost in real time, with support for automatic synchronization of official prices and per-session cost statistics.

Core Features

The plugin provides the following core capabilities:

  • Real-time Display: Renders the cumulative cost of the current session in real time in the status bar area below the input field.
  • Automatic Synchronization: Automatically fetches the latest price list from the official DeepSeek website and supports peak/off-peak pricing configuration.
  • Local Override and Freezing: Supports overriding automatically fetched prices through local configuration, or freezing prices using pin: true.
  • Source Transparency: Displays the price source (official automatic, official fallback on failure, local configuration) and the update timestamp.
  • Model-Router-Based Calculation: Calculates the cost of each call based on the model router.

Installation and Activation

Use the following command to install the plugin from GitHub:

dsh plugin --profile web add git+https://github.com/dog-lin/dsh-session-cost.git

After installation, refresh the browser page (F5). dsh plugin add writes the plugin into the profile’s dsh.profile.bundles, and the plugin’s bundled cordis.patch.yml (bundle layer) is registered automatically at startup.

Note: Host code changes (such as a feature update for this plugin) require restarting dsh web once, because host modules rely on the Node module cache.

Configuration and Hot Reloading

The plugin configuration is located at $DSH_HOME/profiles/web/cordis.patch.yml. The configuration items include:

  • currency: The display and billing currency (ISO 4217).
  • autoUpdate: Whether to automatically synchronize official prices (default is true).
  • updateIntervalHours: The fetch interval (default is 24).
  • pricing: Pricing by model ID. When new prices are fetched from the official site, this section is updated. Adding pin: true makes it immutable.
  • fallback: Pricing rules for models not listed in pricing (default is all 0, meaning unpriced).

If you need to modify the configuration without restarting, you can use profile patch hot reloading to override the entire configuration entry by id: session-cost:

# $DSH_HOME/profiles/web/cordis.patch.yml
- id: session-cost
  name: 'dsh-session-cost'
  config:
    currency: CNY
    autoUpdate: true
    updateIntervalHours: 24
    pricing:
      deepseek-v4-flash: { input: 1, output: 2, cacheRead: 0.02, cacheWrite: 0 }
      deepseek-v4-pro:   { input: 3, output: 6, cacheRead: 0.025, cacheWrite: 0 }
    fallback: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }

Note: During hot reloading, config is replaced as a whole, so it must be written completely. If the same entry is duplicated with insert in the profile layer, it will cause a startup error: duplicate loader entry id: session-cost.

Price Synchronization Mechanism

The plugin uses a three-layer mechanism to ensure correct pricing:

  1. Automatic Official Price Synchronization: At startup and every updateIntervalHours interval (default 24 hours), it fetches the official DeepSeek pricing page. The parser automatically identifies all models in the pricing table. New models (such as future v5 versions) are discovered in a model-agnostic way; as long as they are listed on the official site, their prices are fetched automatically. Price changes are appended to the timeline by effective time, and historical requests are priced based on their own timestamps. If fetching fails, the previous price is retained with a notification.
  2. Local Configuration Override / Freezing: Entries in pricing act as seeds and will be updated by the official site. Setting pin: true gives users full control. fallback is used as a default rule for models not included.
  3. Source Visibility: The projected value carries pricingSource, pricingUpdatedAt, and pricingWarn, which can be viewed through client hover tooltips.

Price history is persisted in $DSH_HOME/storages/dsh-session-cost-pricing.json and is not lost after restart.

Peak and Off-Peak Pricing

Starting from 2026-08-17 (Beijing Time), DeepSeek implements peak and off-peak pricing. The plugin supports two configuration methods:

Method 1: peak / offPeak object

pricing:
  deepseek-v4-flash:
    peak:    { input: 3.0, output: 9.0,  cacheRead: 0.10 }
    offPeak: { input: 1.5, output: 4.5,  cacheRead: 0.05 }

Method 2: schedule timeline

pricing:
  deepseek-v4-flash:
    schedule:
      - from: 0
        input: 1
        output: 2
        cacheRead: 0.02
      - from: 2026-08-17T00:00:00+08:00
        peak:    { input: 3.0, output: 9.0,  cacheRead: 0.10 }
        offPeak: { input: 1.5, output: 4.5,  cacheRead: 0.05 }

The default peak hours are 09:00–12:00 and 14:00–18:00 Beijing Time.

Projected Values and Known Limitations

The sessionCost projected value includes fields such as totalCost, requests, unpricedRequests, and inputTokens, along with pricing source information.

Known limitations are as follows:

  • Session Scope: Costs are only counted for the current session. Model calls made by subagents are not included in the parent session.
  • Reasoning Tokens: Reasoning tokens belong to the output bucket and are billed at the output price, with no additional charge.
  • New Model Identification: New models need to wait for the next fetch (default 24 hours) to be identified. Until then, requests are counted in unpricedRequests and marked as unpriced.
  • Fetch Failure: If repeated fetch failures occur due to changes on the official website, the plugin retains the previous price and displays a notification, instead of silently providing incorrect data.

Summary

dsh-session-cost provides a complete cost-tracking solution covering log replay, price synchronization, and local configuration override. For DSH users who need fine-grained control over DeepSeek API costs, this is a practical tool.

  • Plugin Directory: https://www.skillhub.cn/plugins/dog-lin/dsh-session-cost
  • GitHub Repository: https://github.com/dog-lin/dsh-session-cost