Introduction¶
When using the Perplexity API route within DSH (DeepSeek Harness), the common issues are not that the model itself is unavailable, but that the request format does not match. Anthropic-based models (Claude Opus 5.5, Claude Sonnet 5.5) require an output cap; DSH tool names may conflict with built-in Perplexity tools (such as web_search, fetch_url, sandbox, etc.), and tool schemas missing properties or description are also rejected. GPT-6.1 Sol is also more sensitive to the values of stop, temperature, and reasoningEffort. These errors are all HTTP 400, and from the DSH side, they just look like request failures, making them hard to locate.
Below is an introduction to the community plugin DSH Perplexity Guard, maintained by Kinfxhk. It makes corrections before the request is sent to the Perplexity provider and provides an entry point for one-click repair of provider settings. The plugin package name is @local/perplexity-guard, and the repository name dsh-perplexity-api-fix-plugin is due to historical reasons.
What is this Plugin¶
A DSH Host + Web plugin, current version 1.0.3, MIT license, not affiliated with Perplexity, Anthropic, OpenAI, or DeepSeek.
It addresses a specific scenario: when DSH uses Claude Opus 5.5, Claude Sonnet 5.5, and GPT-6.1 Sol via Perplexity’s API, requests often fail due to formatting issues. The plugin makes corrections on every request sent to the perplexity provider (configurable in settings) and fixes the provider settings that cause failures.
Requirements:
- DSH version
>= 0.2.1-rc.5. - Configure the
llm-pi-aiprovider, with provider idperplexity(or changeproviderIdin the plugin configuration). - The Perplexity API key has been filled in this provider.
The official plugin documentation emphasizes two things: it does not modify message content; when Perplexity returns finish_reason=refusal, this is an upstream content moderation decision, and the plugin only logs it; it does not store or read API keys.
Core Feature: Request Correction¶
Every time a request is sent to the guarded provider, the plugin processes it according to the table below:
| Original Issue | Correction Method |
|---|---|
| Anthropic models refuse calls without an output cap | Add maxTokens (sent as max_output_tokens online), capped by the remaining context window |
DSH tool names conflict with built-in Perplexity tools (web_search, fetch_url, sandbox, etc.), returning HTTP 400 |
Rename to dsh_<name> in the request, and revert to the original name in the streaming tool call response |
Tool schema is type: "object" but lacks properties, or description is empty, returning HTTP 400 |
Add properties: {} or a default description, without touching the arguments themselves |
stop, out-of-range temperature, or unsupported reasoningEffort |
Remove or clamp to valid range |
Configurable items are as follows, with default values coming from the plugin configuration table:
| Key | Default Value | Meaning |
|---|---|---|
enabled |
true |
Enable or disable real-time request correction |
providerId |
perplexity |
Provider ID to guard |
defaultMaxTokens |
32768 |
Default value used when calling without an output cap |
contextWindow |
200000 |
Fallback context window when model information is unavailable |
headroomTokens |
4096 |
Safety margin reserved when capping |
Core Feature: Provider Settings Repair¶
The plugin comes with a Web sidebar entry (called “Perplexity”) and an agent tool perplexity_guard, where the tool’s action has two values: status and repair.
The sidebar page displays provider routes, setting check results, and the last 40 rewrite records or errors. status is used to view current check results.
repair only fills in the following fields for the three models mentioned above:
api: openai-responsesbaseURL: Only written if missing, defaults tohttps://api.perplexity.ai/v1, will not override an existing custom baseURLmaxTokens,contextWindowreasoningEfforts(low/medium/high/xhigh)compat.supportsMaxOutputTokens- 15-minute streaming idle timeout
Constraints are also stated: repair will not delete other models, nor will it replace an already customized baseURL. In other words, it only fixes fields missing from the three target models, without major changes to your provider configuration.
Installation and Enablement¶
The installation path provided in the README is a local bundle installation and does not go through a package manager. First, clone or download the repository, then execute:
plugin_manager(action: "install_bundle", target: "C:\\path\\to\\dsh-perplexity-api-fix-plugin")
Replace target with the actual path of the plugin directory on your machine. Then:
- Restart DSH.
- Open the Perplexity page in the sidebar.
- If check items are displayed on the page, click Repair settings to fix provider settings.
It is recommended to read the source code and LICENSE before installing. The plugin runs with the permissions of the current DSH process, and the install_bundle entry point itself registers scripts to execute arbitrary directories, so a review-before-install approach is preferred.
Known Limitations¶
When a request requires rewriting (tool alias or schema fix), because the public middleware API does not provide a next() to replace options, the plugin re-enters ctx.llm.stream() with a copy. This re-entry call uses the current adapter, so if provider configuration is changed while the stream is in progress, this call might read the new configuration.
The practical impact is minimal: it only affects the rewritten request.
Use Cases¶
Suitable for scenarios where you are using DSH to connect to Perplexity and are using Claude Opus 5.5, Claude Sonnet 5.5, or GPT-6.1 Sol, and encountering direct HTTP 400 errors or models being overly picky about parameters. If provider settings are already complete, the main value after installation lies in request rewriting and sidebar status checking.
Not suitable for: those not using the Perplexity API, those not involving the three models mentioned above, or those unwilling to accept that the plugin will rewrite online request parameters.
Conclusion¶
The value of this plugin lies in turning a class of format-related 400 errors from “troubleshoot yourself” to “auto-complete after installation,” and concentrating common gaps in provider settings into a single button to fix. It is a community-maintained unofficial plugin with clearly defined functional boundaries and limitations.
- Plugin Directory Page: https://www.skillhub.cn/plugins/Kinfxhk/dsh-perplexity-api-fix-plugin
- GitHub: https://github.com/Kinfxhk/dsh-perplexity-api-fix-plugin