dsh-ofm-quota: Interface Quota Dashboard and Automatic Failover for Our Free Model

Preface

When using dsh-our-free-model (Our Free Model, OFM) together with DSH (DeepSeek Harness), credits from multiple free and co-pay channels are independent of each other, and the aggregated panel often doesn’t show “how much is left.” When quota is exhausted, the common front-line symptoms are HTTP 429 or QUOTA_EXHAUSTED, conversations get stuck mid-way, and you have to manually switch to the next endpoint in the model selector. At the end of the day, there’s no reconcilable summary of how many tokens each channel consumed.

dsh-ofm-quota (maintainer dx906, GitHub repository) is a quota management plugin that sits alongside OFM: it eavesdrops on every real dispatch, tracks token/credit consumption, automatically switches to backup endpoints within the same model family when quota is exhausted, and displays remaining balances per channel as cards in the right sidebar. It is not a replacement for OFM; it only reads OFM and channel-pack files written to disk without modifying OFM, so both can be upgraded independently. The plugin has zero runtime dependencies and uses only Node built-in modules.

One thing to note upfront: the deepseek-account (DeepSeek official account) built into the DSH kernel is billed on a pay-as-you-go basis, which is a separate system from OFM’s free lane. By default it will not switch to the official account without the user’s knowledge; when quota is exhausted and no backup endpoint is available, it will report the error truthfully. Only explicit configuration of officialFallback will fall back to the official account; in the panel, the official route is separately marked as “Official · Billed” and pushed to the bottom.

What This Is

  • Name: dsh-ofm-quota (package name dsh-ofm-quota, current version 0.1.0, MIT)
  • Platform: web and desktop (shared profile, installed once, effective on both)
  • Prerequisites: DSH (profile / bundle / cordis plugin mechanism), dsh-our-free-model, Node.js ^22.19.0 || >=24.0.0

Core Features

Usage Detection

The plugin eavesdrops on the kernel’s llm/stream watermark, recording the actual provider/model dispatched for each request and the token usage reported by the adapter (input, output, thinking, cache read).

The interface cross-displays two types of data:

Source Meaning
In-process eavesdropping on llm/stream Real-time, covers only requests within this process after installation
Channel-pack ledger token-ledger.json Accumulated daily by direct\|provider\|accountId\|model, includes history, authoritative value

In “Model usage details” you can see the comparison between eavesdropped counts and channel-pack authoritative counts; discrepancies usually indicate requests that existed before plugin installation.

Automatic Switching on Quota Exhaustion

Trigger conditions cover kernel codes and OFM ecosystem codes (e.g., QUOTA_EXHAUSTED, QUOTA, ACCOUNT_QUOTA, RATE_LIMIT, etc.). Upon match, it searches along the same model family (stripping -free / -preview etc. suffixes during normalization) for backup endpoints that still have quota; if found, it re-runs the current step via agent/request-error and agent/request watermarks, keeping the conversation uninterrupted. The official route is not treated as a “same-name backup” and can only be an explicitly configured fallback.

Default behavior: if no backup endpoint is found, it reports an error and does not automatically switch to the pay-as-you-go official account. Failed endpoints enter cooldown (default 15 minutes), with a maximum number of switches per step (default 3). When switching routes, the source route’s reasoningEffort is discarded to avoid the target adapter not recognizing that level.

Combined with quotaRemaining written after refreshing balances, endpoints with remaining balance can be proactively switched away before triggering a 429.

The DSH right sidebar adds a card showing remaining credits by channel (multiple models under the same channel share one pool of credits, without repeating the same number for each model). Accounts can be expanded; “Model usage details” is collapsed by default. When a channel has no configured credentials, it shows “Balance unknown” rather than faking it as 0.

Installation and Activation

This package is not published to npm (private: true). The official documentation recommends installing from a source-built tarball into the profile, so the installed bytes match the reviewed source code. The desktop desktop profile is exclusively managed by Electron, and running dsh plugin add directly in the CLI may report profile "desktop" is managed exclusively by the Electron application; therefore the README provides manual installation steps.

The following follows the installation flow from the repository README (you need to obtain the source directory first, then reference the built package in the profile):

# Execute inside the cloned dsh-ofm-quota source directory
mkdir -p "$DSH_HOME/profiles/desktop/vendor"
pnpm pack --pack-destination "$DSH_HOME/profiles/desktop/vendor"

In $DSH_HOME/profiles/desktop/package.json:

  1. Add to dependencies: "dsh-ofm-quota": "file:./vendor/dsh-ofm-quota-0.1.0.tgz"
  2. Append to the end of dsh.profile.bundles: "dsh-ofm-quota"

Then resolve dependencies in the profile directory:

cd "$DSH_HOME/profiles/desktop"
pnpm install --frozen-lockfile --offline --ignore-scripts

If the tarball has been updated, you need to sync the integrity (sha512-base64) for this package in pnpm-lock.yaml, otherwise --frozen-lockfile will fail; if the version number is the same, you may need to first rm -rf node_modules/dsh-ofm-quota and then use --force.

After installation, quit DSH from the tray and reopen it. The running host still uses the old code; the startup log should show [ofm-quota] loaded build=<hash> to confirm the version.

Typical Usage

  1. Reopen DSH and open Endpoint Quota in the right sidebar.
  2. Click Sync — read the endpoint list and historical usage from local disk files, mainly depending on:
Data Path
OFM catalog $DSH_HOME/our-free-model/catalog.json
Channel-pack accounts $DSH_HOME/channel-pack/state.json
Channel-pack usage (authoritative) $DSH_HOME/channel-pack/token-ledger.json
  1. Click Refresh Balance — query the actual remaining credits for each channel (the host side calls the channel-pack credits.balances RPC via the in-process owner Peer, avoiding the 403 from non-owner access to /api/channel-pack).
  2. Have conversations normally; with auto-switching enabled, quota exhaustion will switch endpoints within the same-name family.

Configuration is written to $DSH_HOME/ofm-quota/settings.json, and can also be modified via the card or HTTP (/api/ofm-quota, the plugin performs access checks itself). Example:

{
  "enabled": true,
  "autoSwitch": true,
  "maxSwitchesPerStep": 3,
  "cooldownMs": 900000,
  "windowHours": 24,
  "officialFallback": null,
  "syncCatalog": true,
  "manualQuota": {}
}

officialFallback defaults to null, meaning the official billing fallback is not enabled; to enable fallback, you need to explicitly configure this item (specific values depend on the repository documentation). enabled is the master switch, and autoSwitch controls whether to automatically switch routes.

Use Cases and Notes

Who it’s for: Developers who are already using Our Free Model in DSH with mixed multiple channels, want to see remaining credits, reconcile tokens, and minimize conversation interruptions when a single channel is exhausted.

Permissions and security: The plugin runs inside the DSH process, can read OFM and channel-pack files on disk under $DSH_HOME, and registers HTTP and Cordis hooks. Before installation, you should review the source code and the MIT license to confirm compatibility with your environment.

Difference from community descriptions: Community introductions often say “fall back to DeepSeek official when all third-party options are unavailable”; the repository explicitly states by default it does not automatically switch to official billing, and only falls back after configuring officialFallback. The README is authoritative.

Other: When balance query fails, balance: null is not treated as 0; if the host lacks createSharedFetchHandler, the balance capability degrades to no-connection without throwing errors that would crash the host.

Conclusion

dsh-ofm-quota brings OFM’s credits and token consumption scattered across various consoles into the DSH right sidebar, and automatically switches routes by same-name models on quota-type failures, without silently redirecting users to pay-as-you-go official routes by default. Directory and documentation entry points:

  • Community directory page: https://www.skillhub.cn/plugins/dx906/dsh-ofm-quota
  • GitHub: https://github.com/dx906/dsh-ofm-quota
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye