dsh-creative-plugin: Integrating Text-to-Image Tools into DSH Sessions

Introduction

When building agent conversations in DeepSeek Harness (DSH), the model can call tools registered by the host to perform tasks such as web search or running scripts. However, by default, “generating an image and saving it locally” is not treated as a first-class capability. The common approach is to run scripts outside the conversation yourself, or hand-write a curl call to the OpenAI-compatible /images/generations endpoint, then paste the file path back into the conversation—many steps, and it doesn’t fit DSH’s habit of “driving tools with natural language inside a session.”

Below we introduce the community plugin dsh-creative-plugin (maintainer: xiaohuo130, category: web tools): it registers the host tool creative_generate_image in DSH, bridging AI conversations to any OpenAI-compatible text-to-image API. It defaults to StepFun’s step-image-edit-2 and has zero npm dependencies on the script side. Once installed, you can directly ask the assistant “draw me a picture of XXX for me,” and the model will organize the prompt, call the API, write the PNG to local disk, and return the path.

What Is This

dsh-creative-plugin is a plugin for the DSH Web profile (current version 0.2.0, license MIT). Its core does only one thing: register creative_generate_image on the DSH server side, internally execute lib/gen.mjs as a child process, send a POST to <baseUrl>/images/generations, decode the b64_json, and write the file to disk.

Apart from DSH, lib/gen.mjs can also be used standalone as a command-line script—you can generate images even without installing DSH.

Core Features

  1. In-session text-to-image: After the plugin loads, AI in a new session can call creative_generate_image; you only need to describe the image in natural language (README examples include ink-wash bamboo, pixel-style icons, 16:9 illustrations, etc.)—no need to assemble shell commands yourself.

  2. OpenAI-compatible bridge: It relies only on the standard POST /images/generations. The default baseUrl is https://api.stepfun.com/step_plan/v1, and the default model is step-image-edit-2; it can be switched to other compatible services via tool parameters or CLI.

  3. Local PNG and explicit return values: On success it returns JSON containing ok, message, path, and logs; on failure ok is false, along with gen.mjs’s stderr (e.g., API_ERROR 401, NO_B64_JSON in response).

  4. Zero third-party dependencies: Requires Node.js ≥ 18 (using the built-in fetch) and DSH ≥ 0.1.2 (0.2.x also works).

Note: This plugin goes through the pure text-to-image path; image-to-image requires POST /images/edits—even if you pass image to the generations endpoint it will be silently ignored, so it’s not suitable to attempt image-to-image generation with this plugin.

Installation and Activation

The officially recommended way is to install from GitHub into the web profile, with -w to write the workspace configuration:

dsh plugin --profile web add github:xiaohuo130/dsh-creative-plugin -w

After installation, restart DSH (client plugin patches are loaded at startup). Then creative_generate_image will be available in new sessions.

You must provide your own API key for the image service. The plugin reads it in this order:

  1. Environment variable STEPFUN_API_KEY
  2. STEPFUN_API_KEY in ~/.dsh/.credentials.yaml

Example of temporarily setting it on Windows PowerShell:

$env:STEPFUN_API_KEY = 'sk-xxxx'

Or write it into the credentials file:

STEPFUN_API_KEY: sk-xxxx

The key must take effect in the same process environment where you launched DSH; if DSH is already running after changing the environment variable, you need to restart the client.

Typical Usage

In DSH

After installation, key configuration, and restart, just describe what you want in Chinese or English in the conversation, for example:

  • “Draw me an ink-wash style bamboo painting with a rice-paper background”
  • “Generate a pixel-style game character icon with a transparent background”

The model will call the tool; the default output path is ~/Pictures/dsh-creative/creative-<timestamp>.png, and you can also specify the path via the out parameter when calling.

Main tool parameters (consistent with the README):

Parameter Required Description Default
prompt Yes Image prompt (English descriptions usually work better) —
out No Local path for the output PNG ~/Pictures/dsh-creative/creative-<timestamp>.png
model No Image model name step-image-edit-2
baseUrl No Service base URL (excluding /images/generations) https://api.stepfun.com/step_plan/v1

Command Line (without DSH)

node lib/gen.mjs --prompt "a red apple on a wooden table, photo" --out ./out.png

Long prompts can be read from a file:

node lib/gen.mjs --prompt-file prompt.txt --out ./out.png

Switching to a compatible service:

node lib/gen.mjs --prompt "cat in space" --base-url https://api.example.com/v1 --model your-image-model --out ./cat.png

Brief Overview of the Mechanism

User says "draw me a picture of XXX"
      ↓
DSH session → creative_generate_image (lib/index.js)
      ↓  execFile calls node lib/gen.mjs
POST <base-url>/images/generations
      ↓  Take data[0].b64_json, decode and write PNG
Return path to the session

If you’re connecting a non-StepFun service and get errors about unknown parameters, you can edit the request body in lib/gen.mjs (the README mentions that text_mode, cfg_scale, steps, etc. are StepFun tuning fields).

Use Cases and Cautions

Suitable for: Developers already using the DSH Web profile who want one-sentence image generation inside a session with local file output; scenarios where you already have an OpenAI-compatible text-to-image API key and want to quickly connect it to the DSH toolchain; when you need lightweight CLI image generation without pulling in a pile of npm dependencies, you can directly use gen.mjs.

Cautions:

  • The plugin runs with the permissions of the current DSH process and will read/write the out path you specify; before installation, it’s recommended to review the source code and MIT license of the GitHub repository, and never commit API keys to the repo or share screenshots externally.
  • The service must support response_format: "b64_json"; otherwise you’ll get NO_B64_JSON in response.
  • The DSH ecosystem philosophy is “everything is a plugin”; the community catalog SkillHub plugin page is an independent site with no official affiliation with DeepSeek / High-Flyer. This article introduces a community-maintained plugin, not an official app store entry.

Conclusion

dsh-creative-plugin connects DSH sessions to OpenAI-compatible text-to-image APIs via a single host tool: after configuring the key and restarting DSH, you can generate PNGs with natural language and get the local path; when needed, you can change baseUrl / model, or run lib/gen.mjs standalone.

  • Catalog page: https://www.skillhub.cn/plugins/xiaohuo130/dsh-creative-plugin
  • Source code and docs: https://github.com/xiaohuo130/dsh-creative-plugin
羽毛球分组比赛记分
小程序二维码

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

Xiaoye