Introduction

The plugin ecosystem of DeepSeek Harness (DSH) aims to extend functionality through plugins. Generating images in conversation usually requires a complex backend setup or an API key. dsh-imggen, maintained by Stellight, is a static dual-face plugin that provides text-to-image output capability to DSH. This plugin uses the same profile bundle mechanism as dsh-deepseek-balance, which means configurations written into the bundle persist across restarts and do not require approval each time.

Core Features

dsh-imggen provides a complete toolchain for rendering and generating images in conversation.

  1. generate_image model tool: generates images from text prompts and renders them directly in the conversation tool card.
  2. Backend support:
    • Uses Pollinations by default (free, no API key required).
    • Supports OpenAI (DALL·E 3), requiring configuration of OPENAI_API_KEY or DSH_OPENAI_API_KEY.
  3. Tool card features:
    • Download button: supports one-click download of generated images. If the browser cross-origin fetch fails, it automatically falls back to opening in a new tab.
    • History gallery: click the 🖼 历史 button to open a floating gallery, displaying images and prompts in a grid, with support for deleting or clearing them. History records are stored in browser localStorage and retained across restarts.
  4. API selector tab: provides a segmented control on the right side of the input tool row, supporting switching between 🎨 Pollinations and ✨ OpenAI. After selection, the prompt is injected via the systemPrompt variable, and the host side calls the corresponding backend based on the selected option.

Installation and Enablement

Installing this plugin requires placing the package into the profile’s node_modules and configuring the bundle in package.json.

  1. Use the plugin command:
    dsh plugin --profile web add <本包路径>
  1. Manual installation:
    Copy the package to the profile’s node_modules directory, for example:
    ~/.dsh/profiles/web/node_modules/dsh-imggen/
  2. Configure the profile:
    Edit the profile’s package.json and add the dependency and bundles configuration:
    {
      "dependencies": { "dsh-imggen": "1.0.0" },
      "dsh": { "profile": { "bundles": ["...", "dsh-imggen"] } }
    }
  1. Restart Harness:
    Run dsh web to restart; the tool card, gallery, and tab will take effect automatically.

Typical Usage

  • Default generation: call generate_image directly in the conversation. The Pollinations backend is used by default, so images can be generated without additional configuration.
  • Switch backend: select OpenAI in the selector tab on the right side of the input box, and ensure the corresponding key is configured in environment variables or the DSH credentials store.
  • Manage history: click the 🖼 历史 button on the tool card to view the list of generated images. The list is saved in browser localStorage and is not lost when the browser is refreshed or restarted.

Architecture and Security

  • Architecture: adopts a dual-face architecture with no build steps.
    • dsh/index.js (Host): registers the generate_image tool, systemPrompt variable/section, and the same-origin route /dsh-imggen/pref. OpenAI calls and Pollinations validation use Node’s native fetch.
    • dsh/client.js (Client): a handwritten lazy-CJS bundle, responsible for the tool card, history gallery overlay, and image-generation API tab.
  • Security: the repository code contains no API keys. The OpenAI key is used only within the local process for official API calls and is resolved by the credentials service in the order of OPENAI_API_KEY or DSH_OPENAI_API_KEY environment variables.

Conclusion

dsh-imggen simplifies the image generation process in DSH and uses the static bundle mechanism to ensure configuration stability. The project code is open source and can be viewed on GitHub.