dsh-image-tool: Integrating OpenAI-compatible image generation and editing for DeepSeek Harness

Preface

The DeepSeek Harness (DSH) conversation pipeline is oriented towards LLM adapters: streaming text output and tool calls, but it does not have a separate “image generation protocol” channel. If images are to appear in the conversation, the proper approach is for tool results to carry platform-native { type: 'image', attachment } content blocks. Many teams use DeepSeek for chat while utilizing OpenAI-compatible gateways or local services for image generation, with keys and endpoints naturally separated. The missing piece is connecting upstream /images/generations and /images/edits to the DSH tool ecosystem and displaying them as image cards in the interface, rather than as raw JSON.

Below is an introduction to the community plugin dsh-image-tool (Maintainer: lance808, Category: Model Inference). It registers any OpenAI-compatible image generation/editing service as platform tools, allowing the model to generate or edit images by calling them during conversation; the image generation API is configured completely independently from the conversational model API. Directory Page: https://www.skillhub.cn/plugins/lance808/dsh-image-tool, Source Code: https://github.com/lance808/dsh-image-tool (MIT, current package version 0.2.0).

What is this

dsh-image-tool is an image generation and editing plugin for DeepSeek Harness: it internally calls upstream OpenAI-compatible interfaces, writes results into platform image blocks, and registers tool views for generate_image and image_edit. In conversations, it displays thumbnails, full-screen viewing, downloads, and “open in workspace” options. It does not introduce private content blocks, allowing text-only models and multimodal models to share the same message pipeline.

Core Features

Two Main Tools

  1. generate_image: Text-to-image, requests {apiUrl}/images/generations (JSON, response_format: b64_json).
  2. image_edit: Edits based on existing images (inpainting, style changes, outpainting, etc.), requests {apiUrl}/images/edits (multipart/form-data, supports optional mask).

Image generation and editing are designed with separation in required parameters, upstream endpoints, and pre-invocation confirmation; the editing confirmation dialog specifies which image is being edited.

Continuous Editing

When image_edit omits the image parameter, it takes the most recent image in the current session (including images generated in the previous turn or user-uploaded reference images). This is suitable for continuous instructions like “change this image to…” or “add an umbrella to it.”

The original image can also be specified via an attachment ID (e.g., sha256:...) or a path within the session’s working directory; the result will explain the source of the original image.

Decoupled from Conversational Model

apiUrl, apiKey, model / editModel, etc., are configured in the image-tool settings namespace and are independent of chat model credentials. Supports local addresses (e.g., http://127.0.0.1:7860).

Interface and Security

  • DSH Settings → Image Generation: Interface, key, default size and count, save directory, timeout, and size limits, etc.; can click Identify Upstream Models to fetch a list from {apiUrl}/models (requires clicking save to take effect). The key is displayed only with the last few digits on the page; plaintext is not returned.
  • Pre-invocation Confirmation: Separate toggles for image generation and editing (enabled by default) to prevent billable interfaces from being called without human confirmation.
  • Also provides save_generated_image: Saves an already generated image to a specified path without regenerating or incurring charges (README has parameter descriptions).
  • External HTTP: /api/image-tool/*, can be called by other programs without going through the model.

Implementation Highlights (Why this design)

The platform’s built-in image card only recognizes the read_image tool name by default; this plugin registers tool.call.toolview for generate_image / image_edit to prevent the generic card from displaying the image block as JSON. Custom unknown content blocks cause the entire turn to result in UNSUPPORTED_CONTENT, so adherence to platform image blocks is necessary.

Response compatibility includes b64_json, url, image_url.url, etc.; media types are sniffed via magic numbers. Configuration is live, taking effect immediately after changes without needing to restart DSH.

Installation and Activation

The plugin instructions do not use dsh plugin add (as the CLI and pnpm environment may not be available), so using the installation script within the repository is recommended. Execute in the cloned or extracted plugin directory (the parameter is the profile name; if not passed, it reads DSH_PROFILE, otherwise defaults to web):

node scripts/install-into-profile.mjs desktop

The script idempotently: links to ~/.dsh/plugins/dsh-image-tool, creates resolution paths in the corresponding profile’s node_modules, and updates dependencies and dsh.profile.bundles in package.json. If a link already exists pointing elsewhere, it will report an error rather than silently overwriting.

Restart DSH after installation. The runtime environment requires Node ^22.19.0 || >=24.0.0 (see package.json).

Configuration

Path: Settings → Image Generation. Groups include Interface (URL, Key, generation/editing models), Default Output Parameters (sizes categorized as 1K/2K/4K, count), Image Save Path, Pre-invocation Confirmation, and Advanced Options (timeout default 180000 ms, single image limit default 20971520 bytes, plus optional pass-throughs like quality / style / background / outputFormat).

CLI

node scripts/configure.mjs
node scripts/configure.mjs --show
node scripts/configure.mjs --api-url=https://api.openai.com/v1 --api-key=sk-xxx --model=gpt-image-1
node scripts/configure.mjs --set count=2
node scripts/configure.mjs --clear-key

Settings API

// POST /api/settings/update
{ "ns": "image-tool",
  "patch": { "apiUrl": "https://api.openai.com/v1", "apiKey": "sk-...", "model": "gpt-image-1" } }

If editModel and editSize are left empty, they default to model and size, respectively; if both sizes for editing are left empty, size is not sent upstream. If savePath is left empty, it defaults to generated-images/ in the current session’s working directory.

Typical Usage

Text-to-Image

User: Draw a cat waiting for a bus in the rain
Model: → generate_image({ prompt: "A cat waiting for a bus in the rain", size: "1024x1024" })

The tool result will provide the disk path; if the directory is not writable, it may go only into the attachment library with an explanation. Special sizes can be passed by the model in the conversation via the size parameter, not limited to the preset dropdown in the settings page.

Image Editing and Continuous Editing

User: Draw a cat waiting for a bus in the rain
Model: → generate_image({ prompt: "A cat waiting for a bus in the rain" })
User: Change this image to a sunny day
Model: → image_edit({ prompt: "Change to a sunny day, sunlight shining through the clouds" })
User: Add an umbrella to it
Model: → image_edit({ prompt: "Add a yellow umbrella to the cat" })

Example of local inpainting with a mask (mask is a PNG of the same size as the original image, where transparent areas are editable):

{ "prompt": "Replace this area with a starry sky", "image": "generated-images/xxx.png", "mask": "masks/sky.png" }

Use Cases and Notes

Who it is for: Teams or individuals already using tool calls to drive workflows in DSH, who want the chat model to trigger image generation/editing, and whose upstream provides OpenAI-compatible /images/generations and /images/edits (including local inference services).

Please be aware before use:

  • The plugin runs with the permissions of the current DSH process and will access your configured upstream API and session working directory; it is advisable to read the source code and MIT license before installation to confirm endpoint and key ownership.
  • Image generation is a synchronous call with a default timeout of three minutes; real services may incur charges, so it is recommended to keep “Pre-invocation Confirmation” enabled until the workflow is fully verified.
  • The README lists known limitations and explanations such as “placeholder text seen by text-only models”; please refer to the GitHub documentation before deployment.
  • SkillHub and similar sites are community plugin directories and have no official affiliation with DeepSeek / High-Flyer; metadata such as star counts are subject to the display at the time on each site.

Conclusion

dsh-image-tool uses platform-native image blocks and dedicated tool cards to integrate OpenAI-compatible image generation/editing into DeepSeek Harness, separating chat and image generation keys, supporting continuous editing, and offering multiple configuration methods via Settings Page/CLI/API. For details and updates, please see the directory page https://www.skillhub.cn/plugins/lance808/dsh-image-tool and the repository https://github.com/lance808/dsh-image-tool.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye