Preface

When using the dsh-our-free-model (OFM) WorkBuddy / CodeBuddy channel in DeepSeek Harness (DSH), many people are initially blocked by a 400 error: Illegal API invocation from an unapproved channel, with a common business code of 11128. The error message seems to suggest “channel not approved,” but troubleshooting based on domain, headers, or accounts often yields no results. Meanwhile, OFM’s built-in token-ledger.json only records tokens; the credit field returned in the upstream SSE is discarded during parsing, making it difficult to account for actual consumption.

The community plugin dsh-workbuddy-meter (maintainer balongTTY, GitHub repo balongTTY/dsh-workbuddy-meter, SkillHub category admin-security) combines two things into one package: lossless neutralization of risk-control keywords hit in the system prompt, and display of token and credit usage for the buddy / workbuddy channels in the DSH Web UI. Below is an introduction to what it is, what it does, and how to install and use it.

What is this

dsh-workbuddy-meter is a DSH plugin (current documentation version 1.0.1, MIT license, Node requirement ^22.19.0 or >=24.0.0). It depends on the dsh-our-free-model (OFM) being installed and logged into with a WorkBuddy / CodeBuddy account; data comes from OFM’s channel-pack. If OFM is not installed or logged in, an empty panel is expected behavior, not a standalone plugin failure.

The plugin consists of a Host part (index.js: collection, aggregation, HTTP routes, startup patch self-healing) and a Client part (client.js: sidebar “Usage” entry and main panel). It modifies OFM’s pack.js via minimal hooks (patch logic is concentrated in src/patch-engine.mjs, keyword handling in src/lexicon.mjs).

Core Feature 1: Fix unapproved channel (code 11128)

What the error looks like

Typical Chinese prompt:

buddy: Request blocked, please resend Illegal API invocation from an unapproved channel

Or the English original Illegal API invocation from an unapproved channel, HTTP 400, business code 11128 (sometimes 11140, belonging to the same type of validation failure). The README also lists related scenarios: for example, workbuddy: Request blocked by security policy... first message is not system prompt (the first message is not a system role), and 11133 integer_below_min_value (max_tokens too small, unrelated to keyword risk control).

The real cause (inconsistent with the message)

The maintainer’s actual test conclusion is: it is unrelated to the channel, domain, client identity, headers, API Key, etc. Instead, the upstream performs keyword content risk control on the system prompt—when the phrase DeepSeek Harness (complete word pair, case-sensitive) appears in a prose context, it is rejected. Short system prompts (approx. < 1KB) may be allowed even if they contain the keyword, while large request bodies (e.g., real DSH shapes: 316 tools, effort=max, max_tokens=128000) are more likely to stably trigger it, appearing as “intermittent success.”

You can use the same token for comparative verification: a system prompt containing DeepSeek Harness fails, changing it to You are an AI agent. succeeds.

Lossless bypass approach

Insert a zero-width space \u200B between DeepSeek and Harness. The semantics remain almost unchanged to the model, but the string match no longer hits:

// Before
"You are an AI agent powered by DeepSeek Harness."
// After
"You are an AI agent powered by DeepSeek\u200B Harness."

Zero-width characters cannot be inserted into paths (e.g., D:\10_COD\DeepSeek Harness\resources\...), otherwise tool calls will get bad paths. The match needs to skip path contexts. The regex example provided in the README is:

/(?<![\\/])(DeepSeek)[ \u00A0]+(Harness)(?![\\/])/gi

After installing the plugin, the “Keyword Risk Control Neutralization” card at the bottom of the panel provides four switches. Changes take effect immediately without restart (if the master switch is off, outbound requests are not modified at all):

Switch Default Function
Master Switch On Restore original requests when off
Neutralize Identity Keywords On Zero-width space replacement in prose
Inject First System On Inject fallback system if the first message is not system
Hide Brand Words Off More aggressively scatter DeepSeek

If upstream policies change, turn the master switch off to restore unchecked behavior. Switch states are saved in ~/.dsh/workbuddy-meter/lexicon.json.

If you don’t want to install the plugin, you can perform the same string replacement on messages before outbound transmission (the README provides a neutralize example), hooking before JSON.stringify.

Core Feature 2: Credit and Token Usage Panel

The OFM channel ledger is at ~/.dsh/channel-pack/token-ledger.json, recording only tokens. The last frame usage in WorkBuddy / CodeBuddy’s SSE contains a credit field in addition to tokens; this plugin hooks into this field via a patch and writes it per-request to ~/.dsh/workbuddy-meter/usage-<YYYY-MM-DD>.jsonl (UTC+8, daily, append-only). There is also balance.json (account credit balance snapshot) and patch-state.json (patch version and time, etc.).

Panel capabilities (according to README) include: Today / 7 days / 30 days toggle, actual unit price, cache hit rate and hot/cold comparison, model cost-performance ranking, account pool and single account “how much longer / how many tokens can be used”, speed test and rate limit countdown, account pool visualization, and local nickname editing. The sidebar injection point is @deepseek-ai/dsh-client-ui-sidebar-right, with dsh.client.immediately set to true in package.json.

buddy/ corresponds to the CodeBuddy domestic version, while workbuddy/ corresponds to the WorkBuddy international version.

Patching and Self-Healing

The plugin needs to insert two minimal hooks into OFM channel-pack/pack.js: one for meter collection (usage.credit) and one for keyword neutralization via globalThis.__wbLexicon?.rewrite?.(messages). Since pluginManager runs pnpm when loading/unloading arbitrary plugins and may re-extract OFM from the tarball, the patch will be wiped. The Host performs a self-check and automatically re-patches about 1.5s / 1.8s after startup (selfHealed: true), and does not change the switches you selected in the panel.

The command line can use scripts/patch-ofm.mjs (dry-run / --apply / --revert / --check) and scripts/patch-keyword-bypass.mjs to manually preview or apply changes; the README states that even without manual patching, it will self-heal after startup, but manual execution allows you to see the changes immediately.

Note: The patch modifies the loaded pack.js; the README states that after installing a new patch, a DSH restart is required for it to take effect (subsequent switch-based changes do not require restart).

Installation and Activation

This plugin is not a standalone program. Please first ensure the DSH desktop version is available, OFM is installed and at least one WorkBuddy / CodeBuddy account is logged in, and check the Node version with node --version. The README has been tested on Windows 11 + DSH 0.2.1-rc.2; Windows / macOS / Linux are all supported (pure Node + browser-side UI).

The documentation does not provide a one-line CLI like dsh plugin add github:...; the official README recommends two methods.

Explain to the agent in DSH (replace the path with the repository directory on your local machine):

Install this directory as a plugin: <absolute path of this repo>

The agent will call pluginManager/installBundle, completing it in seconds. The README claims this method does not require a restart (this is a different step from the “restart once” required for patch activation below).

Method B: pluginManager RPC

Read http://127.0.0.1:<port> from the DSH runtime context or window title, and POST to the following endpoint (requires valid authentication cookie, see repo CONTRACT.md for details):

POST http://127.0.0.1:<port>/api/pluginManager/installBundle
Content-Type: application/json
Cookie: dsh-auth-<...>=v1.<...>.<...>

{"type":"client-request","rpcId":"install-1","method":"pluginManager/installBundle",
 "payload":{"args":{"spec":"<absolute path of this repo>","options":{"saveExact":true,"enabled":true}}}}

Steps after installation

  1. Optional: Execute the patch script in the repository directory to preview or apply:
cd <this repo>
node scripts/patch-ofm.mjs              # Preview
node scripts/patch-ofm.mjs --apply      # Apply
node scripts/patch-ofm.mjs --check      # Exit code 0 indicates patch is in place

node scripts/patch-keyword-bypass.mjs
node scripts/patch-keyword-bypass.mjs --apply
node scripts/patch-keyword-bypass.mjs --check
  1. Restart DSH once to load the modifications to pack.js into the loaded modules.

  2. Open the sidebar “Usage”: You should see time range switching, credit consumption, “Patched OFM x.y.z” at the bottom, and the “Keyword Risk Control Neutralization” card. If it shows unpatched, click “Patch” on the panel or re-execute the scripts above.

Community directory page (no official affiliation with DeepSeek / High-Flyer): skillhub.cn/plugins/balongTTY/dsh-workbuddy-meter.

Applicable Scenarios and Notes

Who it is for: Developers already using OFM’s WorkBuddy / CodeBuddy in DSH who need to troubleshoot or bypass 11128 type 400 errors, and wish to perform local usage statistics based on the credit and cache hit situations returned by the upstream.

Not suitable for or needs to be known:

  • If OFM is not installed or no account is logged in, the panel has no data.
  • code 6004 usage exceeds frequency limit is upstream rate limiting; you need to switch accounts or wait. EMPTY_RESPONSE etc. may be related to max_tokens being too small; the README suggests max_tokens ≥ 4096 for reasoning scenarios.
  • Keyword neutralization is an emergency measure for currently observed policies; when upstream no longer blocks, the master switch should be turned off.
  • The plugin runs with the permissions of the current DSH process and modifies OFM’s pack.js. Before installation, please read the source code and license to assess whether it meets your security and compliance requirements. SkillHub is a community plugin directory; the installation source and maintenance responsibility lie between the plugin author and the user.

Conclusion

dsh-workbuddy-meter addresses the misleading unapproved channel 400 error on WorkBuddy / CodeBuddy and the OFM credit metering gap separately: the former uses switchable, lossless prompt neutralization and first-message system fallback, while the latter uses a patch to collect usage.credit and aggregates it in the Web UI. If you are blocked by 11128 or need to see the real credit consumption of buddy / workbuddy locally, you can get the plugin from the directory page or GitHub and complete installation, a one-time restart, and panel verification according to the README.

  • Directory Page: https://www.skillhub.cn/plugins/balongTTY/dsh-workbuddy-meter
  • GitHub: https://github.com/balongTTY/dsh-workbuddy-meter