Introduction¶
When pasting screenshots into DeepSeek Harness (DSH) and selecting a local OpenAI-compatible vision model (e.g., LM Studio, llama.cpp), requests sometimes fail directly with errors like 'url' field must be a base64 encoded image. The image bytes themselves can be decoded; the issue is often in the MIME label: after DSH normalizes attachments, it stores screenshots with alpha as WebP, and dsh-llm-pi-ai writes the mediaType returned by readImageRequest() verbatim into data:image/...;base64,.... Some local services only accept PNG/JPEG labels, so the entire call gets rejected.
Below we introduce the community plugin dsh-webp-relabel (maintainer lilinhua0413). Without transcoding, it only changes the label of the WebP request image prepared by DSH to image/png, making local vision endpoints like LM Studio and llama.cpp willing to process the same base64 payload. The plugin is categorized as a networking tool in the DSH community directory; the repository currently has 0 stars and uses the MIT license (see package.json).
What Is This¶
dsh-webp-relabel is a Cordis patch-style DSH plugin: it wraps the readImageRequest() of the attachments service, replacing the mediaType in the returned object from the default image/webp to image/png, without changing the pixel data.
It targets a fixed behavior in DSH’s built-in pipeline, not a specific cloud API:
dsh-attachment-localselects the container by alpha during normalization:hasAlpha ? "image/webp" : "image/jpeg"; screenshots typically go through WebP.- The request image ladder only has
alpha:webpandopaque:jpeg, with no PNG tier and no corresponding configuration option. - The adapter takes the label from
readImageRequest(...).mediaTyperather than fromImageBlock.attachment.mediaTypeon the message block, so modifying only the message content is ineffective.
The plugin runs with the current DSH process permissions; before installing, it is recommended to read the source code and cordis.patch.yml on GitHub to confirm it meets your environment and compliance requirements.
Core Features¶
Relabeling, Not Transcoding¶
The implementation is equivalent to returning in the readImageRequest() wrapper layer:
return { ...version, mediaType: 'image/png' };
The diagnostic script test/diagnostics/relabel-vs-transcode.py in the repository README compared several combinations on LM Studio: WebP bytes with image/webp result in HTTP 400; the same WebP bytes with image/png result in HTTP 200, and the model correctly understands the image. This shows that these local services mainly validate the label, and sharp / sips transcoding is not necessary for compatibility.
test/diagnostics/vision-read.py also verified that the model actually “sees” the image: text drawn in WebP sent under the name image/png can be read correctly.
How the Patch Hooks In¶
Three implementation details are clearly described in the README and align with DSH’s internal behavior:
- Must hook
readImageRequest: The OpenAI-compatible adapter’s MIME comes from the return value of this method; changing the attachment description in the chat message does not change the online payload. - Takes effect on the next request: The adapter resolves the service each time via
resolveAttachments: () => ctx.get("attachments"), without needing to restart DSH or start a new session. - Modify the prototype, not the instance:
ctx.get()returns Cordis’s traceableProxy; instance-level assignment may be swallowed by the shadow receiver; only methods on the prototype can be reliably intercepted.
The user-visible attachment handle text still comes from ref.mediaType, so it won’t be falsely reported as PNG; the storage layer still accurately describes WebP.
Configuration Options¶
By default, it replaces image/webp with image/png and enables a line of debug logging. Only add a config block in the profile’s cordis.patch.yml when you need to override it (the bundle already ships defaults):
- id: dsh-webp-relabel
name: 'dsh-webp-relabel'
config:
from: image/webp # Label to replace (default)
to: image/png # Replacement label (default)
debug: true # Log one line per relabeled image (default)
Installation and Activation¶
The DSH ecosystem is “everything is a plugin”; the SkillHub directory page is a community index and has no official affiliation with DeepSeek / High-Flyer. The following installation methods all come from the repository README; please replace <your-profile> with your profile name.
Install from Release Package (No npm Registry Required)¶
Download dsh-webp-relabel-1.0.0.tgz from GitHub Releases, then:
dsh plugin --profile <your-profile> add /path/to/dsh-webp-relabel-1.0.0.tgz
Install from npm¶
dsh plugin --profile <your-profile> add dsh-webp-relabel
Local Directory Link (Tested in README)¶
Point to the directory in plugin management (the bundle comes with a cordis.patch.yml that registers the loader line; on DSH 0.2.1-alpha.2 it was observed that install_bundle does not insert the line separately, so the bundle needs to ship its own patch):
plugin_manager install_bundle target = link:/absolute/path/to/dsh-webp-relabel
Manually Writing the Patch¶
Insert into the profile’s cordis.patch.yml:
- insert:
- id: dsh-webp-relabel
name: 'dsh-webp-relabel'
Runtime requirements: Node >=22.19 (see engines in package.json).
Typical Usage and Verification¶
After enabling the plugin, just use DSH multimodal chat normally: paste a screenshot and select a local OpenAI-compatible vision model; no additional API calls are needed.
It is recommended to keep debug: true initially and confirm in the DSH console that each image is relabeled, for example:
[dsh-webp-relabel] relabel #1: image/webp -> image/png (1200x800px, 84521B, ref sha256:...)
At the same time, you can check in the model service’s own request logs whether the payload is "url": "data:image/png;base64,..." rather than image/webp.
Applicable Scenarios and Notes¶
Who It’s For
- Users who use local OpenAI-compatible vision endpoints like LM Studio, llama.cpp in DSH and are rejected due to the WebP label.
- Developers who want minimal changes and accept the trade-off of “label and container inconsistency” (the README clarifies: effective for services that only validate the label).
Limitations (from README)
- The bytes are still WebP, but the label says PNG. If the upstream strictly validates file magic numbers, it will still fail; in that case, real transcoding should be done instead of relabeling.
readImageRequest()cannot see the routing target, so the plugin affects all providers; if you only want it to apply to local routing, additionalllm/streammonitoring is needed and limited byoptions.provider.- It depends on DSH’s internal
attachmentsservice andreadImageRequeston its prototype; if it breaks after a major DSH version upgrade, prioritize checking these two places.
How to Disable
Disable the plugin in the DSH plugin manager, or set the config to to: image/webp. The README explains that the original readImageRequest will be restored from the saved descriptor, making the patch reversible.
Conclusion¶
dsh-webp-relabel uses a one-line MIME relabeling to bridge the gap between DSH’s request image ladder lacking a PNG tier and local vision services only recognizing PNG/JPEG labels. If your pain point is screenshots entering local vision models reporting base64 image field errors, you can first install it as described above and confirm image/webp -> image/png in the debug logs.
- Directory page: https://www.skillhub.cn/plugins/lilinhua0413/dsh-webp-relabel
- Source code and documentation: https://github.com/lilinhua0413/dsh-webp-relabel