🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

绘图路由 xiaozhe7772222/dsh-draw-router

DeepSeek Harness
xiaozhe777222276 天前有提交已提供中文文档扫描:含敏感能力

接入任意兼容端点,让对话直接生成图片

35.1/100
综合分
5
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/9/18 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

自动兼容检查有告警:未发布到 npm registry,仅可从源码安装。
安装命令 · 需先装 dsh CLI 引擎
dsh plugin --profile web add xiaozhe7772222/dsh-draw-router
该包不可直接 npm 安装,改从 GitHub 源安装(明细见下方安装检查)

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:已验证
是什么
dsh 原生插件 · vision
装得上吗
本站已真实安装成功
非静态推断
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
更新放缓:最近一次提交在 76 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
社区实装还没有人打卡 · 装过的第一个就是你
安装兼容性检查⚠ 装前注意

未发布到 npm registry,仅可从源码安装

展开查看检查明细 ↓

以下结论由程序自动检查 npm 包、engines 声明与入口文件得出,未做人工实机验证——能装不等于用着没问题。

✗npm 包dsh-draw-router(未发布到 npm,仅可源码安装)
✓Node 引擎未声明 engines.node
✓dsh CLI 依赖未声明 dsh 版本约束
✓入口文件main/exports/bin 已声明

验证方式:npm registry 存在性 + package.json 静态校验 · 最后检查 2026/10/31 17:44:34

安全扫描自动 · 静态分析源码
v2.7.0
🔵 扫描:含敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描发现插件具备触达本地系统的能力:执行外部命令、读写/删除本地文件、读取剪贴板或密钥类环境变量(至少其一)。这是能力清单,不是危险判定——具体能力项与证据见下方,安装前请自行判断是否需要。

读写/删除本地文件发起外部网络请求
查看扫描证据(共 10 处,展示前 10 条)
  • 读取本地文件
    lib/index.js:124
    try { return existsSync(CONFIG_FILE) ? JSON.parse(readFileSync(CONFIG_FILE, 'utf8')) : {} } catch { return {} }
  • 读取本地文件
    lib/index.js:124
    try { return existsSync(CONFIG_FILE) ? JSON.parse(readFileSync(CONFIG_FILE, 'utf8')) : {} } catch { return {} }
  • 写入本地文件
    lib/index.js:142
    mkdirSync(dirname(CONFIG_FILE), { recursive: true })
  • 写入本地文件
    lib/index.js:147
    writeFileSync(CONFIG_FILE, JSON.stringify(out, null, 2), 'utf8')
  • 发起网络请求
    lib/index.js:159
    const resp = await fetch(modelsUrl, { headers: buildHeaders(s.apiKey), signal })
  • 发起网络请求
    lib/index.js:240
    const resp = await fetch(endpoint, {
  • 发起网络请求
    lib/index.js:269
    const createResp = await fetch(createUrl, {
  • 发起网络请求
    lib/index.js:299
    const pollResp = await fetch(taskUrl, { headers: { 'Authorization': `Bearer ${s.apiKey}` }, signal: pollSignal })
  • 发起网络请求
    lib/client.js:43
    const r = await fetch('/dsh-draw-router/sources', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
  • 发起网络请求
    lib/client.js:47
    const r = await fetch('/dsh-draw-router/sources')
扫描于 2026/11/3(0 天前) · 范围 入口闭包 + 发布文件清单 · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/cordis@deepseek-ai/dsh-tools
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

功能亮点

  • 接入兼容端点
  • 自动发现绘图模型
  • 对话直接生成图片

README

由 DeepSeek 最新模型翻译生成
dsh-draw-router DeepSeek Harness 缺少生图能力?这个插件让它能。 DeepSeek Harness (DSH) can't generate images? This plugin fixes that. 🐧 由 小哲 设计并构建 (@xiaozhe7772222) 作者: 小哲 (xiaozhe7772222) 🐧 · 维护者: 小哲 (xiaozhe7772222) 🐧 License: MIT DSH Node Author Made with ❤️ 填一个 baseURL + API Key → 自动识别绘图模型 → 对话中直接生图 Add a baseURL + API Key → auto-detect image models → draw from chat The Problem DeepSeek Harness (DSH) 是一个强大的 LLM agent 框架,但它没有内置的图像生成能力。你无法让 agent 画一张图、创建一张示意图或生成一张视觉图像——它根本不知道怎么做。 dsh-draw-router 通过充当一个通用图像生成路由器来解决这个问题。
展开完整文档(README 剩余 1 节)
dsh-draw-router

DeepSeek Harness 缺少生图能力?这个插件让它能。

DeepSeek Harness (DSH) can't generate images? This plugin fixes that.

🐧 由 小哲 设计并构建 (@xiaozhe7772222)

作者: 小哲 (xiaozhe7772222) 🐧 · 维护者: 小哲 (xiaozhe7772222) 🐧

License: MIT
DSH
Node
Author
Made with ❤️

填一个 baseURL + API Key → 自动识别绘图模型 → 对话中直接生图

Add a baseURL + API Key → auto-detect image models → draw from chat

The Problem

DeepSeek Harness (DSH) 是一个强大的 LLM agent 框架,但它没有内置的图像生成能力。你无法让 agent 画一张图、创建一张示意图或生成一张视觉图像——它根本不知道怎么做。

dsh-draw-router 通过充当一个通用图像生成路由器来解决这个问题。它将 draw_image 和 draw_list_sources 注册为 agent 工具,因此 DSH agent 可以像运行 bash 命令一样自然地生成图像——在对话中即可完成。

✨ Features

| Feature | Description |
| 🎨 Agent-native image gen | DSH agent 可以按需绘制图像——只需说“画一张图” |
| 🔍 Auto model discovery | 输入任意 OpenAI 兼容的 baseURL + API key → 插件调用 GET /v1/models 并自动检测图像模型(绝不硬编码模型名称) |
| 🏭 Multi-provider | SenseNova · StepFun · Agnes · Qwen · Tongyi Wanxiang · Jimeng/Seedream · Hunyuan · GPT Image · Flux · Stable Diffusion · Imagen · 以及任何 OpenAI 兼容端点 |
| 🎚️ Manual model add | 对于未通过 /v1/models 暴露图像模型的提供商,可手动添加模型 |
| 🔌 REST API | 在运行时添加/移除/探测绘图源;通过 POST /dsh-draw-router/draw 绘图 |
| 💾 Persistent config | 绘图源持久化到 draw-config.json,重启后依然保留 |
| 🔒 Key masking | API 响应绝不暴露完整的 API key |

🧠 How it works

User: "帮我画一张流程图,展示API调用过程" │ ▼ Agent calls draw_image(source="sensenova", prompt="...") │ ▼ Plugin calls GET {baseURL}/v1/models → auto-detect image models │ ▼ Plugin calls POST {baseURL}/v1/images/generations │ ▼ Returns image URL → agent displays it in conversation 模型检测通过名称模式匹配工作——没有硬编码的模型列表。该插件可识别 30 多种模式,包括 image、draw、generation、flux、sd-3、hunyuan、seedream、agnes-image、step-image、qwen-image、wan、imagen、gpt-image、dall、t2i、i2i 等。

每个提供商的 API 特性都会被自动处理(依据官方文档):

| 提供商 | 自动检测的模型 | 特殊处理 |
| SenseNova(商汤) | sensenova-u1-fast | 标准 OpenAI 格式 |
| StepFun(阶跃) | step-image-edit-2、step-2x-large | steps、cfg_scale、negative_prompt |
| Agnes | agnes-image-2.1-flash、2.0-flash | size 档位 1K-4K、ratio |
| TokenRhythm / Qwen | 手动添加 | 标准 OpenAI 格式 |
| DashScope(阿里云百炼) | wanx-v1、wan2.6-t2i | 异步任务 + 轮询 |
| GPT Image | gpt-image-1.5、dall-e-3 | 标准 OpenAI 格式 |
| Flux | flux-2-pro、flux.1-dev | 标准 OpenAI 格式 |
| Stable Diffusion | sd-3.5-large、stable-image-ultra | 标准 OpenAI 格式 |
| Hunyuan(混元) | hunyuan-image-3.0 | 标准 OpenAI 格式 |
| Seedream(即梦/豆包) | seedream-4.x | 标准 OpenAI 格式 |
| Imagen | imagen-4 | 标准 OpenAI 格式 |

🏗️ 架构

┌─────────────────────────────────────────────────────────────┐
│ DeepSeek Harness (DSH) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ dsh-draw-router (plugin) │ │
│ │ │ │
│ │ ┌──────────────┐ ┌────────────────────────────┐ │ │
│ │ │ Agent Tools │ │ REST API (webServer) │ │ │
│ │ │ │ │ │ │ │
│ │ │ draw_image │ │ GET /dsh-draw-router/ │ │ │
│ │ │ draw_list_ │ │ sources │ │ │
│ │ │ sources │ │ POST /dsh-draw-router/ │ │ │
│ │ └──────┬───────┘ │ sources │ │ │
│ │ │ │ POST /dsh-draw-router/ │ │ │
│ │ │ │ draw │ │ │
│ │ ┌──────▼───────────────────────────────┐ │ │
│ │ │ Draw Router Core │ │ │
│ │ │ - Source registry (baseURL+apiKey) │ │ │
│ │ │ - Model discovery (GET /v1/models) │ │ │
│ │ │ - Pattern matching (30+ patterns) │ │ │
│ │ │ - Per-provider API adaptation │ │ │
│ │ │ - draw-config.json persistence │ │ │
│ │ └──────┬───────────────────────────────┘ │ │
│ │ │ │ │
│ └─────────┼──────────────────────────────────────────┘ │
│ ▼ │
│ ┌────────────────────────────────────────────────┐ │
│ │ 提供商图像 API │ │ │ │ SenseNova · StepFun · Agnes · Qwen · Flux ... │ │ │ └────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘

📦 安装

支持两种安装方式。

方式 A:基于文件的安装(推荐 / Recommended)

克隆仓库并复制文件:

1. Clone
git clone https://github.com/xiaozhe7772222/dsh-draw-router.git
cd dsh-draw-router

2. Copy plugin files
mkdir -p ~/.dsh/profiles/web/plugins/dsh-draw-router
cp -r lib package.json cordis.patch.yml ~/.dsh/profiles/web/plugins/dsh-draw-router/

3. Link to node_modules (so DSH bundle loader can find it)
ln -sfn ../plugins/dsh-draw-router ~/.dsh/profiles/web/node_modules/dsh-draw-router

4. Add to bundles in ~/.dsh/profiles/web/package.json
(add "dsh-draw-router" to the bundles array)

方式 B:终端命令安装(终端命令安装)

通过 DSH CLI 直接安装:

If you have published the plugin to npm registry:
cd ~/.dsh/profiles/web
dsh plugin add dsh-draw-router --profile web

Or install from local package:
dsh plugin add /path/to/dsh-draw-router --profile web

无论使用哪种方式,之后都需要重启 DSH:

npx @deepseek-ai/dsh web

验证其是否正常工作:

Check the HTTP server is up
curl http://127.0.0.1:3080/dsh-draw-router/sources

Should return: {"sources":{}}

⚙️ 配置

选项 1:通过 cordis.patch.yml 进行静态配置

- insert:
- id: draw-router
name: dsh-draw-router
inject: [tools, webServer]
config:
sources:
stepfun:
baseUrl: https://api.stepfun.com/v1
apiKey: your-stepfun-key
sensenova:
baseUrl: https://token.sensenova.cn/v1
apiKey: your-sensenova-key
agnes:
baseUrl: https://apihub.agnes-ai.com/v1
apiKey: your-agnes-key

baseURL 提示:提供 API 根地址(例如 https://api.stepfun.com/v1)。插件会自动追加 /images/generations 和 /models。

选项 2:REST API(运行时)

Add a source (auto-probes models)
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"add","name":"stepfun","baseUrl":"https://api.stepfun.com/v1","apiKey":"sk-xxx"}'

List sources + detected models
curl http://127.0.0.1:3080/dsh-draw-router/sources

Add a manual model (for providers not exposing image models via /v1/models)
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"addModel","name":"tokenrhythm","model":"qwen-image-2.0"}'

Generate an image
curl -X POST http://127.0.0.1:3080/dsh-draw-router/draw \
-H 'Content-Type: application/json' \
-d '{"source":"sensenova","prompt":"a cute cat","size":"2048x2048"}'

🔌 REST API 参考
| 端点 | 方法 | 请求体 | 描述 |
| /dsh-draw-router/sources | GET | — | 列出所有源 + 检测到的图像模型 |
| /dsh-draw-router/sources | POST | {action:"add", name, baseUrl, apiKey} | 添加源并探测模型 |
| /dsh-draw-router/sources | POST | {action:"remove", name} | 移除源 |
| /dsh-draw-router/sources | POST | {action:"probe", name} | 重新探测模型 |
| /dsh-draw-router/sources | POST | {action:"addModel", name, model} | 添加手动模型 |
| /dsh-draw-router/sources | POST | {action:"removeModel", name, model} | 移除模型 |
| /dsh-draw-router/draw | POST | {source, prompt, model?, size?, ratio?, n?, response_format?} | 生成图像 |

🛠️ 故障排查

安装问题

1. cannot resolve profile bundle "dsh-draw-router"
运行 dsh web 时在启动过程中失败并报此错误。

bundle 加载器找不到该插件。修复方法: Ensure the symlink exists ln -sfn ../plugins/dsh-draw-router ~/.dsh/profiles/web/node_modules/dsh-draw-router

And confirm "dsh-draw-router" is in the bundles array of package.json
(as a string, NOT as an object)

2. failed to apply loader entry draw-router: unsupported JSON schema
插件已加载,但 agent 工具 schema 验证失败。

如果你修改了源代码,就会出现这种情况。output.schema 必须包含 additionalProperties: false(或 true),并且可选参数不能带有 required: false。请直接使用随附的 lib/index.js。

3. 插件已加载,但聊天中没有 draw_image 工具 Agent 看不到绘图工具。

tools 服务必须可用。检查 cordis.patch.yml 中的 inject: [tools, webServer] 是否完好,然后重启 DSH。也可用以下命令验证:
cd ~ && DSH_SKINS_DIR=... npx -y @deepseek-ai/dsh --profile web --dump-config 2>/dev/null | grep -A3 draw-router

运行问题

4. 添加源返回 imageModels: [] 自动检测未找到绘图模型。

某些提供商(例如 TokenRhythm)不会通过 /v1/models 暴露图像模型——只有聊天模型。修复方法:手动添加模型。
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"addModel","name":"tokenrhythm","model":"qwen-image-2.0"}'

5. 绘图失败,返回 HTTP 402 / quota_exceeded 提供商账户没有余额。

这是账户计费问题,不是插件 bug。请为提供商账户充值或切换到另一个源:
curl -X POST http://127.0.0.1:3080/dsh-draw-router/draw \
-H 'Content-Type: application/json' \
-d '{"source":"sensenova","prompt":"a cat","size":"2048x2048"}'

6. 绘图失败,报 field Size invalid 该尺寸值不受提供商模型支持。

不同提供商支持不同的尺寸:
- SenseNova sensenova-u1-fast:2048x2048、1664x2496、2752x1536 等。
- StepFun:1024x1024、768x768、1280x800
- Agnes:1K/2K/3K/4K + ratio

如有疑问,省略 size,让提供商使用其默认值。

7. 绘图失败,返回 HTTP 401 / 403 API Key 无效或缺失。

通过脱敏值检查来源的 Key,并使用正确的 Key 重新添加:
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"remove","name":"bad-source"}'
then add again with correct apiKey

8. 请求超时大图片或较慢的提供商可能需要 30-120 秒。

该插件使用 120 秒的请求超时。如果你的提供商较慢,请重试一次——图像生成本身就需要时间。

9. Web UI 中看不到设置卡片插件正常工作(REST API 有响应),但没有显示设置卡片。

客户端 bundle 从 lib/client.js 加载。请确保:
- package.json 中有 "client": { "platform": "web" }
- 使用干净的缓存重启 DSH(浏览器强制刷新:Ctrl+Shift+R)
- 如果仍然失败,插件的服务端工具仍然可用——改为通过 REST API 进行配置。

10. draw-config.json 损坏崩溃后持久化文件损坏。

删除它并重启——通过 cordis.patch.yml 配置的来源将重新加载,你可以重新添加运行时来源。

🗂️ 项目结构

dsh-draw-router/
├── lib/
│ ├── index.js # Server: model discovery, draw logic, agent tools, REST API
│ └── client.js # Client: settings panel card (optional)
├── package.json # Package metadata + DSH bundle declaration
├── cordis.patch.yml # Static config example
├── draw-config.json # Runtime persistence (gitignored)
├── README.md
├── CHANGELOG.md
└── LICENSE

🏷️ 主题标签

deepseek-harness · dsh · dsh-plugin · draw · image-generation · text-to-image · sensenova · stepfun · agnes · qwen · wanxiang · tongyi · flux · imagen · stable-diffusion · hunyuan · seedream · jimeng · doubao · gpt-image · dall-e · openai · midjourney · kling · cogview

📄 许可证

MIT 许可证——可自由使用、修改、分发。切勿将你的真实 API Key 提交到公共仓库。

中文文档

问题

DeepSeek Harness (DSH) 是一个强大的 LLM Agent 框架,但它没有内置的生图能力。你无法让 agent 画图、创建图表或生成视觉内容——它根本不会。

dsh-draw-router 作为一个统一的图像生成路由器解决了这个问题。它向 DSH agent 注册了 draw_image 和 draw_list_sources 工具,让 agent 像执行 bash 命令一样自然地生图——在对话中一句话就够了。

✨ 功能特性

| 功能 | 说明 |
| 🎨 Agent 原生生图 | Agent 可按需生图——一句“画一张图”即可 |
| 🔍 自动识别模型 | 填入任意 OpenAI 兼容的 baseURL + API Key → 插件调用 GET /v1/models 自动识别绘图模型(不预设模型名) |
| 🏭 多厂商支持 | 商汤 · 阶跃 · Agnes · 千问 · 通义万相 · 即梦/Seedream · 混元 · GPT Image · Flux · Stable Diffusion · Imagen · 以及任意 OpenAI 兼容端点 |
| 🎚️ 手动添加模型 | 对于不通过 /v1/models 暴露绘图模型的厂商,可手动添加模型 |
| 🔌 REST API | 运行时增删绘图源、探测模型、直接生图 |
| 💾 配置持久化 | 绘图源持久化到 draw-config.json,重启后依然有效 |
| 🔒 Key 脱敏 | API 响应永不暴露完整 API Key |

🧠 工作原理

用户: "帮我画一张流程图,展示API调用过程" │ ▼ Agent 调用 draw_image(source="sensenova", prompt="...") │ ▼ 插件调用 GET {baseURL}/v1/models → 自动识别绘图模型 │ ▼ 插件调用 POST {baseURL}/v1/images/generations │ ▼ 返回图片 URL → agent 在对话中展示图片

模型识别通过名称关键词匹配——没有硬编码模型列表。插件识别 30+ 种模式,包括 image、draw、generation、flux、sd-3、hunyuan、seedream、agnes-image、step-image、qwen-image、wan、imagen、gpt-image、dall、t2i、i2i 等。

每个厂商的 API 差异按官方文档自动处理:

| 厂商 | 自动识别的模型 | 特殊处理 |
| 商汤 SenseNova | sensenova-u1-fast | 标准 OpenAI 格式 |
| 阶跃 StepFun | step-image-edit-2, step-2x-large | steps, cfg_scale, negative_prompt |
| Agnes | agnes-image-2.1-flash, 2.0-flash | size 档位 1K-4K, ratio |
| TokenRhythm / 千问 | 手动添加 | 标准 OpenAI 格式 |
| 阿里云百炼 DashScope | wanx-v1, wan2.6-t2i | 异步任务 + 轮询 |
| GPT Image | gpt-image-1.5, dall-e-3 | 标准 OpenAI 格式 |
| Flux | flux-2-pro, flux.1-dev | 标准 OpenAI 格式 |
| Stable Diffusion | sd-3.5-large, stable-image-ultra | 标准 OpenAI 格式 |
| 腾讯混元 | hunyuan-image-3.0 | 标准 OpenAI 格式 |
| 即梦/豆包/Seedream | seedream-4.x | 标准 OpenAI 格式 |
| Google Imagen | imagen-4 | 标准 OpenAI 格式 |

🏗️ 系统架构

┌─────────────────────────────────────────────────────────────┐
│ DeepSeek Harness (DSH) │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ dsh-draw-router(插件) │ │ │ │ │ │ │ │ ┌──────────────┐ ┌────────────────────────────┐ │ │ │ │ │ Agent 工具 │ │ REST API (webServer) │ │ │ │ │ │ │ │ │ │ │ │ │ │ draw_image │ │ GET /dsh-draw-router/ │ │ │ │ │ │ draw_list_ │ │ sources │ │ │ │ │ │ sources │ │ POST /dsh-draw-router/ │ │ │ │ │ └──────┬───────┘ │ sources │ │ │ │ │ │ │ POST /dsh-draw-router/ │ │ │ │ │ │ │ draw │ │ │ │ │ ┌──────▼───────────────────────────────┐ │ │ │ │ │ 绘图路由器核心 │ │ │ │ │ │ - 绘图源注册表 (baseURL+apiKey) │ │ │ │ │ │ - 模型发现 (GET /v1/models) │ │ │ │ │ │ - 模式匹配 (30+ 种模式) │ │ │ │ │ │ - 厂商专属 API 适配 │ │ │ │ │ │ - draw-config.json 持久化 │ │ │ │ │ └──────┬───────────────────────────────┘ │ │ │ │ │ │ │ │ └─────────┼──────────────────────────────────────────┘ │ │ ▼ │ │ ┌────────────────────────────────────────────────┐ │ │ │ 厂商图像 API │ │ │ │ 商汤 · 阶跃 · Agnes · 千问 · Flux ... │ │ │ └────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘

📦 安装

支持两种安装方式。

方式一:文件安装(推荐)

克隆仓库并复制文件:

1. 克隆
git clone https://github.com/xiaozhe7772222/dsh-draw-router.git
cd dsh-draw-router

2. 复制插件文件
mkdir -p ~/.dsh/profiles/web/plugins/dsh-draw-router
cp -r lib package.json cordis.patch.yml ~/.dsh/profiles/web/plugins/dsh-draw-router/

3. 软链到 node_modules(让 DSH bundle 加载器能找到) ln -sfn ../plugins/dsh-draw-router ~/.dsh/profiles/web/node_modules/dsh-draw-router

4. 在 ~/.dsh/profiles/web/package.json 的 bundles 数组中添加 "dsh-draw-router"

方式二:终端命令安装

通过 DSH CLI 直接安装:

如果插件已发布到 npm registry:
cd ~/.dsh/profiles/web
dsh plugin add dsh-draw-router --profile web

或从本地包安装:
dsh plugin add /path/to/dsh-draw-router --profile web

两种方式任选其一后,重启 DSH:

npx @deepseek-ai/dsh web

验证是否安装成功:

检查 HTTP 服务
curl http://127.0.0.1:3080/dsh-draw-router/sources

应返回:{"sources":{}}

⚙️ 配置说明

方式一:静态配置(cordis.patch.yml)

- insert:
- id: draw-router
name: dsh-draw-router
inject: [tools, webServer]
config:
sources:
stepfun:
baseUrl: https://api.stepfun.com/v1
apiKey: your-stepfun-key
sensenova:
baseUrl: https://token.sensenova.cn/v1
apiKey: your-sensenova-key
agnes:
baseUrl: https://apihub.agnes-ai.com/v1
apiKey: your-agnes-key

baseURL 提示:填 API 根地址(如 https://api.stepfun.com/v1)。插件会自动补全 /images/generations 和 /models。

方式二:REST API(运行时)

添加绘图源(自动探测模型)
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"add","name":"stepfun","baseUrl":"https://api.stepfun.com/v1","apiKey":"sk-xxx"}'

列出绘图源 + 已识别的模型
curl http://127.0.0.1:3080/dsh-draw-router/sources

手动添加模型(用于不通过 /v1/models 暴露绘图模型的厂商)
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"addModel","name":"tokenrhythm","model":"qwen-image-2.0"}'

直接生图
curl -X POST http://127.0.0.1:3080/dsh-draw-router/draw \
-H 'Content-Type: application/json' \
-d '{"source":"sensenova","prompt":"一只可爱的猫","size":"2048x2048"}'

🔌 REST API 参考

| 端点 | 方法 | Body | 说明 |
| /dsh-draw-router/sources | GET | — | 列出所有绘图源 + 已识别的绘图模型 |
| /dsh-draw-router/sources | POST | {action:"add", name, baseUrl, apiKey} | 添加绘图源并探测模型 |
| /dsh-draw-router/sources | POST | {action:"remove", name} | 移除绘图源 |
| /dsh-draw-router/sources | POST | {action:"probe", name} | 重新探测模型 |
| /dsh-draw-router/sources | POST | {action:"addModel", name, model} | 手动添加模型 |
| /dsh-draw-router/sources | POST | {action:"removeModel", name, model} | 移除模型 |
| /dsh-draw-router/draw | POST | {source, prompt, model?, size?, ratio?, n?, response_format?} | 生成图片 |

🛠️ 故障排查

安装问题
1. 启动报错 cannot resolve profile bundle "dsh-draw-router" 启动 DSH 时 bundle 加载器找不到插件。

解决:确保软链存在 ln -sfn ../plugins/dsh-draw-router ~/.dsh/profiles/web/node_modules/dsh-draw-router

确认 package.json 的 bundles 数组中有 "dsh-draw-router"(字符串格式,不是对象)

2. 启动报错 unsupported JSON schema 插件加载时工具 schema 验证失败。

说明你修改了源码。output.schema 必须包含 additionalProperties: false(或 true),可选参数不能有 required: false。请使用原版 lib/index.js。

3. 插件加载成功但 draw_image 工具不可用 Agent 看不到绘图工具。

检查 cordis.patch.yml 中的 inject: [tools, webServer] 是否完整,然后重启 DSH。也可通过以下命令验证:
cd ~ && DSH_SKINS_DIR=... npx -y @deepseek-ai/dsh --profile web --dump-config 2>/dev/null | grep -A3 draw-router

运行问题

4. 添加绘图源后返回 imageModels: [] 自动探测没有找到绘图模型。

有些厂商(如 TokenRhythm)不通过 /v1/models 暴露绘图模型。解决:手动添加模型。
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"addModel","name":"tokenrhythm","model":"qwen-image-2.0"}'

5. 生图失败 HTTP 402 / quota_exceeded 厂商账户余额不足。

这是账户计费问题,不是插件 bug。给厂商充值或切换到其他绘图源:
curl -X POST http://127.0.0.1:3080/dsh-draw-router/draw \
-H 'Content-Type: application/json' \
-d '{"source":"sensenova","prompt":"一只猫","size":"2048x2048"}'

6. 生图失败 field Size invalid 尺寸参数不被该厂商的模型支持。

不同厂商支持的尺寸不同:
- 商汤 sensenova-u1-fast:2048x2048、1664x2496、2752x1536 等
- 阶跃:1024x1024、768x768、1280x800
- Agnes:1K/2K/3K/4K + ratio

如果不确定,省略 size 让厂商使用默认值。

7. 生图失败 HTTP 401 / 403 API Key 无效或缺失。

通过脱敏值检查源 Key,重新添加正确的 Key:
curl -X POST http://127.0.0.1:3080/dsh-draw-router/sources \
-H 'Content-Type: application/json' \
-d '{"action":"remove","name":"bad-source"}'
然后用正确的 Key 重新添加

8. 请求超时大图或慢厂商可能需要 30-120 秒。

插件使用 120 秒请求超时。如果厂商较慢,可重试一次——生图本身需要时间。

9. 设置面板不显示 REST API 正常工作但设置卡片不显示。

Client bundle 从 lib/client.js 加载。确保:
- package.json 有 "client": { "platform": "web" }
- 重启 DSH 后浏览器硬刷新(Ctrl+Shift+R)
- 如果仍然不显示,插件的服务端功能仍然正常——通过 REST API 配置即可。

10. draw-config.json 损坏崩溃后持久化文件损坏。

删除后重启——通过 cordis.patch.yml 配置的源会重新加载,运行时添加的源重新添加即可。

🗂️ 项目结构

dsh-draw-router/
├── lib/
│ ├── index.js # 服务端:模型发现、绘图逻辑、agent 工具、REST API │ └── client.js # 客户端:设置面板卡片(可选) ├── package.json # 包元数据 + DSH bundle 声明 ├── cordis.patch.yml # 静态配置示例 ├── draw-config.json # 运行时持久化(已 gitignore) ├── README.md ├── CHANGELOG.md └── LICENSE

🏷️ 标签 (Topics)

deepseek-harness · dsh · dsh-plugin · draw · image-generation · text-to-image · sensenova · stepfun · agnes · qwen · wanxiang · tongyi · flux · imagen · stable-diffusion · hunyuan · seedream · jimeng · doubao · gpt-image · dall-e · openai · midjourney · kling · cogview

📄 许可证

MIT License — 自由使用、修改、分发。请勿将你的真实 API Key 提交到公开仓库。
预览分享卡片长什么样 ↓xiaozhe7772222/dsh-draw-router
分享 · DeepSeek Harness Hub
xiaozhe7772222/dsh-draw-router

接入任意兼容端点,让对话直接生成图片

这是你的仓库?认领条目

回到顶部