Preface

DeepSeek Harness (DSH) uses a plugin architecture designed to modularize various functions. When developing agents or using them in daily work, it is necessary to manage the OpenCode Go Plan, DeepSeek API balance, and MiniMax Token Plan simultaneously. The dsh-quota-monitor plugin targets this scenario by providing a draggable quota monitoring window in the lower-left corner of the interface, displaying real-time usage and estimated costs for each resource.

Overview

This is a Web plugin used to monitor quotas and usage across multiple providers in the DeepSeek Harness Web interface. It solves the problem of being unable to view balances and costs in a unified way in multi-model environments.

Core Features

  1. Real-Time Display: The card in the lower-left corner of the interface displays in real time the OpenCode Go Plan (5-hour/weekly/monthly), DeepSeek API balance/usage, and MiniMax Token Plan (5-hour/weekly).
  2. Task Metrics: When expanded, the card displays four metrics for the current task: cache hit rate, input Tokens, output Tokens, and estimated cost.
  3. P0 Custom Metering (v0.6.0): Based on llm/stream waterfall accounting, it no longer depends on session_projcache.json. The ledger is stored in $DSH_HOME/storages/dsh-opencode-quota-usage.jsonl, and session statistics automatically fall back to the custom ledger when cache is missing.
  4. P1 Provider Abstraction: Supports two model types: balance and windows. Built-in presets include deepseek-official, opencode-go, new-api, and sub2api, while configurable parsers are also provided.
  5. Cost Estimation: Supports conversion from USD to CNY; prices and exchange rates are refreshed automatically every day.
  6. UI Interaction: The status bar card is draggable, and its width follows the sidebar. It stays synchronized with the chat box model selection; switching models automatically switches the card view.

Installation and Enabling

Before installation, complete opencode auth login and configure DEEPSEEK_API_KEY.

dsh plugin --profile web add github:mouse33333/dsh-quota-monitor

After installation, restart the GUI application. Browser-side UI changes support HMR hot replacement, but host-side routing and pricing service changes require restarting the application to take effect.

Configuration

Using the plugin’s config field, you can override default thresholds or add custom providers.

- id: dsh-quota-monitor
  name: dsh-quota-monitor
  config:
    cacheTtlMs: 5000
    timeoutMs: 15000
    lowBalanceThreshold: 20
    providers:
      # 覆盖内置预设:给 opencode-go 设独立低阈值
      opencode-go:
        lowBalanceThreshold: 10
      # 新增自定义网关(复用通用余额解析器)
      my-gateway:
        label: 自建网关
        kind: balance
        url: https://gw.example.com/v1/balance
        apiKeyEnv: MY_GW_KEY
        parse: { builtin: generic-balance }
        currency: USD

Configuration Details:
* Provider fields: kind (balance|windows), url, apiKeyEnv, headers, auth (bearer/raw), currency, parse (builtin/source/file), lowBalanceThreshold.
* Parsers: Supports built-in parsers (such as deepseek-balance) as well as JS functions pasted via parse.source or script files referenced via parse.file.
* Credentials: The OpenCode token is read from ~/.local/share/opencode/auth.json or the environment variable OPENCODE_API_KEY; the DeepSeek key is read from DEEPSEEK_API_KEY or an environment variable.
* Prices and exchange rates: Refreshed once per day and cached for 24 hours; falls back to the built-in price table when offline.

Security and Notes

  • Key security: All API keys are sent only as Authorization headers to the configured provider URLs and are not exposed to the browser.
  • Data privacy: The usage ledger records only token counts and session metadata, containing no keys or message content.
  • API dependencies: The OpenCode zen usage API has no official documentation and is a reverse-engineered API; upstream changes must be tracked manually.
  • Version changes: Starting from v0.6.0, the plugin is a bundle type, so you no longer need to manually edit the profile’s cordis.patch.yml.

Summary

Through its custom metering solution and provider abstraction layer, this plugin provides stable, real-time quota monitoring for DeepSeek Harness Web. It centralizes balance and usage management for multiple models and ensures secure storage of credentials.