dsh-image-gen-plugin: Integrating OpenAI-Compatible Image Generation into DeepSeek Harness

Preface

When building Agents in DeepSeek Harness (DSH), a common requirement is to let the model “generate images on command” and save the files to the local workspace. Writing your own Host tools, assembling request bodies, and creating settings pages and chat cards involves significant work; conversely, simply pasting API documentation into a conversation often fails to make the model reliably call /images/generations or /images/edits.

Here we introduce the community plugin dsh-image-gen-plugin (maintainer: miller-owo): it registers the generate_image tool for the Agent and adds an “Image Generation” page in the DSH “Settings”, using OpenAI-compatible image interfaces to accomplish text-to-image and image-to-image tasks. Request parameters are aligned with Dasipaint’s openai.rs::build_request. It can interface with official OpenAI, relay gateways, or self-hosted reverse proxies. The plugin is categorized as “Model Inference”; the repository GitHub currently has 0 stars and is licensed under MIT (package.json version 1.1.0).

What is this

dsh-image-gen-plugin is a DSH plugin package that primarily does two things:

  1. Injects generate_image into the Agent: pass in a prompt to generate images, and the results are written to a local directory.
  2. Configures the model, interface URL, key, output format, default count, and save path in Settings → Image Generation.

The HTTP layer uses POST {apiUrl}/images/generations (text-to-image) or POST {apiUrl}/images/edits (image-to-image, multipart). When the endpoint is backed by a natural language-driven painting model, the prompt is passed through as-is without GPT-image style template wrapping. Fields recognized only by the OpenAI image interface (such as moderation) are not sent by default and can be controlled via settings switches.

Core Features

generate_image Tool

The tool exposes 8 parameters (image quality quality is only a call parameter, not configured in the settings page; if omitted, it generates at high quality):

Parameter Required Description
prompt Yes Natural language prompt; clarify text within the image using quotes and explain the position
resolution No auto (default) or widthxheight, e.g., 1536x864
quality No low / medium / high / xhigh / max
count No 1–10 images; uses the default value from settings if not provided
background No auto / transparent / opaque
location No Save location; defaults to the session workspace if not provided
images No Array of source image paths for image-to-image, max 16 images, each ≤50MB
mask No Optional PNG mask, must correspond to exactly 1 source image

There is no separate mode parameter: passing images triggers editing (/images/edits), while not passing it triggers generation (/images/generations).

The validation order for custom resolutions matches OpenAI documentation: width and height must be multiples of 16; aspect ratio between 1:3 and 3:1; longest side ≤3840 (can be reduced via maxEdge); total pixels between 655,360 and 8,294,400 (so 3840×3840 exceeds the limit, the maximum valid square is approximately 2880×2880).

Settings Page and Config

Configuration is written to the profile’s cordis.patch.yml. Main fields include:

Field Default Value Description
apiUrl https://api.openai.com/v1 Base address, automatically appends /images/generations
secret Empty Bearer token
model gpt-image-2.5-flare Can be changed to any model id supported by the endpoint
count 1 Default number of images
outputFormat png png / jpeg / webp
outputCompression 100 For jpeg / webp only
background auto Default background
moderation auto This field is only sent when explicitly selected as low
defaultResolution auto Used when the call does not specify a resolution
maxEdge 3840 Max limit for the longest side of custom resolutions
outputDir Empty If empty, uses assets/ inside the plugin package
fileNameFormat {time}-{prompt} Placeholders: {time}, {prompt}, {index}, {uniq}
requestTimeoutSec 600 Timeout for a single request
sendsModeration true If disabled, never sends moderation
sendsOutputCompression true If disabled, never sends output_compression

The filename template supports exclusive creation; if a name exists, it automatically appends -2, -3 suffixes to prevent overwriting.

Tool Cards and Prompt Suggestions

Tool cards are displayed in the chat: showing the first few lines of the prompt while generating; after the image is generated, the full prompt and actual parameters passed can be expanded. The plugin passes the prompt as-is to the endpoint model. The README suggests focusing on “content, layout, text in quotes” and avoiding Stable Diffusion-style weight syntax or quality spells. For image-to-image, describe the changes rather than restating the entire image.

Installation and Activation

dsh plugin add installs the package into the profile and appends it to the bundle stack according to the package’s dsh.bundle.patch, without requiring manual configuration file changes.

Installation command for the web profile (from the original README):

dsh plugin --profile web add dsh-image-gen-plugin

You can also let the Agent execute install_bundle of plugin_manager within the Harness, filling in dsh-image-gen-plugin for target.

To install from a local directory, replace the package name with the absolute path of this plugin directory, for example:

dsh plugin --profile web add "D:\MyProject\deepseek-image-generation\dsh-image-gen-plugin"

After installation, refresh the page (http://127.0.0.1:3080). Host-side JavaScript changes require a DSH restart to load the new generation; to upgrade, simply re-execute add to overwrite the installation.

Uninstallation:

dsh plugin --profile web remove dsh-image-gen-plugin

Typical Usage

Following the steps above, you can use it in the order described in the README:

  1. Open Settings → Image Generation, fill in the API address, API key, and select the model.
  2. In a new session, tell the Agent something like “Draw a corgi wearing a hat”; the Agent calls generate_image, writes the image to the output directory, and displays it in a card.
  3. For image-to-image, provide the source image path to the Agent and explain what to change (e.g., change background, change fur color, add a scarf).

Self-check command provided by the maintainer (in the plugin directory):

npm run check

You can use node show-prompt.mjs to view the full text of the tool definition read by the model.

Applicable Scenarios and Notes

Who is it for: Developers already running Agents in DSH who want to use OpenAI-compatible image APIs (including self-hosted or gateways) for text-to-image / image-to-image, and require a settings page and in-chat preview.

Permissions and Security: The plugin runs with the permissions of the current DSH process. It can read and write directories configured and carry the API key you fill in for outbound requests. Before installation, you should read the source code and LICENSE to ensure the interface and data storage locations comply with your environment policies. The README has a dedicated “Security” section explaining how keys are stored; it is recommended to read it before deployment.

Ecosystem Note: DSH adopts an “everything is a plugin” extension approach; the SkillHub directory page is a community site, with no official affiliation to DeepSeek / High-Flyer, and is not an official app store.

Conclusion

dsh-image-gen-plugin converges OpenAI-compatible image generation into a generate_image tool plus a settings page, distinguishing between JSON text-to-image and multipart image-to-image links. If you want the Agent in your Harness to reliably generate and save images, you can integrate it using the installation commands in this article, configure apiUrl and secret in the settings, and call it directly via natural language in a new session.

  • Directory Page: https://www.skillhub.cn/plugins/miller-owo/dsh-image-gen-plugin
  • GitHub: https://github.com/miller-owo/dsh-image-gen-plugin
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye