Introduction¶
When using a vision model with DeepSeek Harness (DSH), such as meta/muse-glimmer, you may frequently encounter 400 errors if the server is an OpenAI-compatible gateway such as LM Studio. The error message is usually 'url' field must be a base64 encoded image.
The root cause is that DSH’s default attachment plugin, dsh-attachment-local, automatically transcodes images with an Alpha channel, such as PNG screenshots, into image/webp. In contrast, the LM Studio gateway only accepts image/png, image/jpeg, and image/gif at the protocol layer, so it directly rejects WebP formats.
The dsh-image-base64 plugin wraps the attachment storage’s readImageRequest() method and transcodes unsupported image formats to PNG before the request is sent, eliminating this format incompatibility.
What It Is¶
This is a DeepSeek Harness plugin maintained by the user pureexe and released under the MIT license.
Its core purpose is to use the sharp library to transcode image formats that do not meet the gateway’s requirements into image/png before a vision request is sent. It does not change how images are stored; it only changes the data format included in the request sent to the model.
Core Features¶
- Format conversion: It intercepts
readImageRequest()calls and checks the returned media type. - Transcoding logic: If the media type is not in the accepted list (by default
image/png,image/jpeg, andimage/gif), it usessharpto re-encode it asimage/png. - On-demand processing: Formats already in the accepted list are passed through unchanged, and only formats that would cause errors are transcoded.
Installation and Enabling¶
Before installing, ensure that the plugin source code is available, for example at /home/pakkapon/dsh-image-base64.
- Run the installation command in the DSH profile directory:
dsh plugin --profile <name> add /home/pakkapon/dsh-image-base64
- Add the plugin to the
dsh.profile.bundleslist in the profile’spackage.json:
{
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-image-base64"
]
}
}
}
- Restart the profile (or wait for automatic loading, depending on the
patchReloadsetting in the configuration) to activate the plugin.
Configuration¶
By default, the plugin only accepts [image/png, image/jpeg, image/gif], which matches LM Studio’s whitelist. If you need to support other formats, you can configure the plugin ID in the profile’s cordis.patch.yml.
- id: image-base64-compat
config:
acceptedMediaTypes: [image/png, image/jpeg, image/gif, image/webp]
Notes¶
- Modifies request projection only: This plugin only patches the image portion of the request sent to the model; it does not change the actual format of images in attachment storage.
- Larger file size: Transcoding to PNG is lossless, but if the original image is a large JPEG or WebP photo, the resulting PNG file will usually be larger than the original.
- Format negotiation: If the gateway actually supports WebP, it is recommended to add it to the
acceptedMediaTypeslist instead of relying on the plugin to transcode it.
Conclusion¶
For developers who need to deploy vision models with strict gateways such as LM Studio, dsh-image-base64 provides a lightweight solution that avoids request failures caused by MIME type mismatches. The plugin source code is available in the GitHub repository pureexe/dsh-image-base64.