Preface¶
When connecting to third-party LLM gateways in DeepSeek Harness (DSH), failure causes are often hidden within the raw response returned by the provider. Channel unavailability, insufficient balance, token lacking access to a specific model, and actual key errors may manifest as different HTTP statuses and messages on the gateway side. If the UI uniformly displays the same “Invalid API Key” message, troubleshooting can be misled—for example, the gateway might clearly state “no available channels under the current group,” yet the interface suggests changing the key.
The following is an introduction to the community plugin dsh-llm-error-classify (maintained by lxl8182, categorized under SkillHub as admin-security). It rewrites the classification of terminal failures in the llm/stream link, allowing raw provider text for non-pure-authentication 401/403 errors to pass through to the interface, while scrubbing potential echoed credential fragments based on their shape.
What is this¶
dsh-llm-error-classify is a DSH Web-side error classification correction plugin: it rewrites provider failures that the pi-ai adapter prematurely marks as AUTH due to text-matching rules into PROVIDER_ERROR, and retains the (sanitized) original error text.
In the host, AUTH is the only code that triggers the UI to clear the body content and replace it with a fixed “Invalid API Key” message; PROVIDER_ERROR is not included in this special-case set, so the interface will display the message content directly. The plugin does not modify retry policies, nor does it alter classifications for non-AUTH errors.
Origin of the problem¶
The pi-ai adapter has a priority rule in classifyPiAiError: if the message text contains 401 or 403, it immediately returns AUTH, and this check is performed before more specific judgments for quotas or channels. Consequently, various gateway failures are tagged with the same code before reaching the UI.
The UI handles AUTH by clearing the display body in event projection and overriding it with failure.auth text in chat and trace components. The result is that the original gateway text becomes invisible to the user.
Core Functionality¶
The plugin hooks into the llm/stream waterfall via cordis.patch.yml, wrapping the adapter’s chunk iterator to intercept terminal finish chunks before the agent loop persists them.
There is only one rule: If a terminal failure has code === 'AUTH', change it to PROVIDER_ERROR and retain the original text (after credential sanitization).
PROVIDER_ERROR is deliberately kept out of the UI’s special-case set and the default retryable set (which only contains EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT). Therefore, the display and retry behavior remain consistent with the original AUTH handling, without triggering extra retries due to the rewrite.
Before passing through the original text, the plugin replaces substrings that may leak credentials based on their shape with [redacted], such as common vendor-prefixed keys (sk-…, sk-proj-…, ghp_…, etc.) and Bearer <token> within messages. This is shape matching, not reading real keys; bare keys without vendor prefix characteristics cannot be identified, which is stated as a known limitation in the README.
Installation and Activation¶
The plugin is a zero-dependency, pure JavaScript package with no prepare script; no separate npm install is required after installation. The package.json requires Node >=22.
Install from GitHub:
dsh plugin --profile web add github:lxl8182/dsh-llm-error-classify
Or install from a local directory:
dsh plugin --profile web add /path/to/dsh-llm-error-classify
After installation, restart dsh web.
Uninstall:
dsh plugin --profile web remove dsh-llm-error-classify
If installed via github:, upgrade can be performed with:
dsh plugin --profile web update dsh-llm-error-classify
A restart of dsh web is also required after upgrading.
Verification Methods¶
The repository provides logic-layer and end-to-end probes (must be run in a copy containing the complete repository files; the copy installed into the profile via dsh plugin add only contains index.js, cordis.patch.yml, and README.md).
Logic layer:
node test.mjs
This covers positive cases (various 403/401 gateway scenarios all converting AUTH → PROVIDER_ERROR), negative cases (other codes remaining unchanged), text retention, credential sanitization, and non-finish chunk behavior.
End-to-end via the real waterfall:
DSH_REPO=/path/to/dsh-checkout node probe-e2e.mjs
DSH_REPO points to the DSH source checkout directory; by default, it can be the current directory.
Use Cases and Notes¶
Who it is for: Developers or operations personnel using DSH Web with third-party gateways via pi-ai, who frequently encounter 401/403 errors uniformly displayed as “Invalid API Key,” and need to see the raw provider text to distinguish between channel, quota, permission, and key issues.
Security and Trust: The plugin runs with the permissions of the current dsh process and changes how failure information enters the UI state (displaying raw text after sanitization). Before installing, you should review the GitHub repository source code and the MIT License to ensure it complies with your security policy. If your gateway echoes bare keys without common prefix shapes in error messages, do not rely on this plugin’s sanitization capabilities.
Ecosystem Note: The DSH community plugin directory is maintained on independent sites like SkillHub and is not officially affiliated with DeepSeek / High-Flyer; installation commands should follow the README.
Version and Limitations: In current materials, the package version is 0.2.0. The plugin only performs AUTH → PROVIDER_ERROR conversion and shape-based credential sanitization. If the host adjusts UI special-cases or retry sets, the plugin’s chosen code may need synchronization. The root cause lies in the host’s classification and UI strategy; the README provides three upstream modification suggestions. Once upstream is fixed, this plugin can be uninstalled.
Conclusion¶
dsh-llm-error-classify uses minimal changes to rewrite provider failures incorrectly marked as AUTH into PROVIDER_ERROR, making raw gateway text visible in the interface and reducing ineffective key swaps caused by the misleading “Invalid Key” error. See the SkillHub plugin page for the directory and details, and GitHub: lxl8182/dsh-llm-error-classify for source code and installation instructions.