Introduction

In agentic development and day-to-day use with DeepSeek Harness (DSH), prompt generation, reasoning, and context caching consume a large number of tokens. Without real-time financial feedback, developers may face unexpected bill spikes, miss overnight discount windows, or fail to detect runaway sub-agent costs. The dsh-cost-meter plugin is designed to address these issues by embedding a high-precision cost telemetry chip directly into the DeepSeek Harness conversation header, providing real-time session cost display, time-of-day rate switching, and token pricing functionality.

Plugin Overview

The plugin is maintained by GooDAnDReaDY and licensed under the MIT License. Using incremental streaming telemetry, it calculates prompt, completion, and cache read/write tokens in real time without polling. The plugin supports a dual-tier (peak/off-peak) rate engine, automatically detects official DeepSeek peak periods (offering a 50% off-peak discount), and ensures historical session spend remains permanently anchored to the rates in effect at execution time.

Core Features

  1. Incremental streaming telemetry: Calculates token consumption in real time, including prompt, completion, and cache reads/writes, without causing UI jank.
  2. Dual-tier rate engine: Supports official DeepSeek peak periods and automatically detects the 50% off-peak discount.
  3. Immutable UTC half-hour time slots: Historical spend data is permanently bound to the rate tier in effect at execution time.
  4. Provider-aware routing: Distinguishes directly connected providers from managed gateways (such as OpenRouter).
  5. Interactive UI and settings: Supports custom currency symbols, exchange rates, and time zone configuration.
  6. Performance and caching: Uses O(K) change calculation optimization and supports server-side caching and ETags.
  7. Catalog synchronization and export: Supports manual catalog synchronization (via API or UI) and provides quick summary export.
  8. Budgets and suggestions: Provides budget threshold alerts and cost-saving recommendations.
  9. Status and multi-model support: Native dot status indicators (with pulse warnings) and collapsible multi-model panels.
  10. Context cache savings: Automatically calculates and highlights financial savings from caching.

Installation and Enablement

To install the plugin, use the official installation command:

dsh plugin --profile web add @goodandready/dsh-cost-meter

After installation, restart the DeepSeek Harness instance and refresh the browser to load the plugin.

Configuration and Usage

Configuration is divided into GUI settings and advanced YAML settings.

Basic Configuration (GUI)

Primary scalar parameters (such as currency, usdRate, displayTimeZone, useOpenRouter, and refreshHours) can be edited directly in the UI under Settings → Plugins → Plugin Settings → Cost Meter.

Advanced Configuration (YAML)

Complex dictionary or array-based configurations (such as prices, modelMap, deepseekPeakPrices, manualPeakWindowsUtc, and manualOffPeakMultiplier) must be configured in settings.yaml.

Configuration Options:
* currency: Currency symbol to display (for example, $, ₽, €).
* usdRate: Exchange rate multiplier (currency units per 1 USD).
* displayTimeZone: IANA time zone used to format peak/off-peak windows.
* useOpenRouter: Whether to automatically fetch rates and discount windows from OpenRouter.
* prices: Manual rate configuration (input, output, and cache hit/write prices per million tokens).
* modelMap: Model routing overrides ("provider/model" -> OpenRouter model ID).
* manualPeakWindowsUtc: Manually defined peak periods (HH:MM-HH:MM UTC).
* manualOffPeakMultiplier: Manual off-peak multiplier.

Data Synchronization

  • API synchronization: POST /dsh-cost-meter/refresh
  • UI synchronization: Click the “Sync Now” button in the interface.

Runtime Environment and Dependencies

  • Node.js: Version >= 20 is required.
  • Dependency: zod.
  • Peer Dependencies:
    • @deepseek-ai/cordis (version >= 4.0.1)
    • @deepseek-ai/schemastery (version >= 3.18.1)

Summary

dsh-cost-meter addresses the lack of cost visibility in AI development by integrating a real-time cost chip into the header. Developers can adjust their strategies based on real-time data and reduce costs by taking advantage of off-peak periods. The plugin follows DSH Locale Standards and supports localization for Chinese and English.