Introduction

DeepSeek Harness (DSH) adopts a plugin architecture. During development or debugging, it is often necessary to confirm the actual balance of the current route on the provider ledger, rather than relying on estimates based on local tokens. The dsh-gateway-wallet plugin integrates this functionality into the sidebar and reads the site ledger directly.

Plugin Overview

This is an independent third-party community project maintained by MuAllen. It reads the remaining balance and actual deductions for the current API key on the site ledger, and supports Sub2API, New API, and the official DeepSeek service. This plugin is complementary to TokenLedger (usage ledger): the usage ledger records tokens for local sessions, while this plugin reads the balance reported by the site for that key.

Installation and Enablement

The web profile of DeepSeek Harness is required.

dsh plugin --profile web add github:MuAllen/dsh-gateway-wallet

Restart DSH and perform a hard refresh in your browser. A “Site Balance” entry will appear at the bottom of the sidebar.

Upgrade or remove:

dsh plugin --profile web update dsh-gateway-wallet
dsh plugin --profile web remove dsh-gateway-wallet

Core Features

The plugin adds a “Site Balance” entry to the lower-left corner of the DSH sidebar. After clicking it, it displays:

  • Current route, token name, masked Key (sk-••••xxxx); if multiple routes are configured, you can switch between them.
  • Amount information: balance, today’s actual deduction, and cumulative usage.
  • Usage statistics: today’s / cumulative token buckets and request counts.
  • Plan information: plan name, RPM / TPM.
  • Balance alerts: when the balance is below $1 / ¥5, the sidebar button displays an indicator (visible even when the sidebar is collapsed).

Supported Scope and Interfaces

The plugin identifies the site type by probing interface responses and reads the corresponding data:

  • Sub2API (such as some domestic relay sites): reads /v1/usage. It obtains balance, today’s / cumulative actual deductions, and token buckets.
  • New API / One API and other forks: reads /api/usage/token/. It obtains quota and used amount; today’s value is shown only when logs are returned completely. If the key quota is unlimited, the balance is displayed as undisclosed, and the token field separately indicates that this key is unlimited.
  • DeepSeek official: reads /user/balance. It only shows balance; there is no today’s actual deduction.

For mismatched sites, it explains the reason and does not convert balances using another set of rules.

Notes

  • This plugin is an independent third-party community project and has no affiliation, sponsorship, or endorsement from DeepSeek or any relay sites.
  • Amounts shown in the panel are based on the site’s response at that time and are not reconciliation statements or tax receipts. Interface changes, differences in site reporting, or network failures may cause blank values or inconsistencies with the console.
  • This software is provided under the MIT license “as is,” and the author is not liable for any losses caused by using this plugin.
  • The complete API Key is used only within the local Host process as an Authorization header; it does not enter the browser and is not sent to any server of the plugin author.

Links

  • GitHub: https://github.com/MuAllen/dsh-gateway-wallet