npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-tool-image-gen

v0.1.0

Published

DSH tool plugin: generate images through ToAPIs async GPT-Image-2 API (submit task, poll, download).

Readme

dsh-tool-image-gen

一个 DeepSeek Harness 图像生成工具插件:对接 ToAPIs 异步图像 API(GPT-Image-2 等),提供两个模型可调用工具:

  • image_gen:文生图 / 图生图。提交任务 → 轮询 → 下载到工作区 generated/,返回本地路径 + 公开 URL。
  • image_upload:把本地图片上传到 ToAPIs,换取公开 URL(可作 image_gen 的参考图)。

特性

  • 异步任务管理:POST /v1/images/generations 建任务,轮询 GET /v1/images/generations/{id} 取结果。
  • 本地参考图自动上传:image_gen 的 referenceImages 直接接受本地文件路径(自动走上传接口换 URL),也接受公开 URL。
  • 内联预览:结果注册进 DSH 附件系统(超 5MB 自动用 sips 压缩 JPEG),并在文本里附带 Markdown 图片链接。
  • 凭据:key 从环境变量或 ~/.dsh/.credentials.yaml 读取(TOAPIS_API_KEY),永不进对话。
  • 尺寸 1:1/3:2/2:3/4:3/3:4/5:4/4:5/16:9/9:16/2:1/1:2/21:9/9:21,分辨率 1k/2k/4k,n 张数。

安装

# 1. 装进 profile
cd ~/.dsh/profiles
npm install dsh-tool-image-gen
# 或者本地开发:npm link dsh-tool-image-gen

# 2. 接线(cordis.patch.yml,本包自带 bundle manifest,dsh plugin add 可自动接线)
# - insert:
#     - id: image-gen
#       name: 'dsh-tool-image-gen'

# 3. 配 key:~/.dsh/.credentials.yaml 里加
# TOAPIS_API_KEY: 你的key
# chmod 600 ~/.dsh/.credentials.yaml

# 4. 重启 dsh

配置

| 字段 | 默认 | 说明 | |---|---|---| | apiKeyEnv | TOAPIS_API_KEY | 凭据引用名 | | baseURL | https://toapis.com/v1 | API 基址 | | model | gpt-image-2 | 模型 id(也可用 gpt-image-2-vip、gemini 系列等) | | size | 1:1 | 默认比例 | | resolution | 1k | 默认分辨率 | | pollIntervalMs / maxAttempts | 3000 / 60 | 轮询策略 | | timeoutMs | 600000 | 协作超时 | | outputDir | <cwd>/generated | 图片落盘目录 |

用法

// 文生图
{ "prompt": "赛博朋克城市夜景海报", "size": "16:9", "resolution": "2k" }

// 图生图(本地路径自动上传)
{ "prompt": "把这张图改成水彩画风格", "referenceImages": ["/path/to/photo.png"] }

// 上传换 URL
{ "filePath": "/path/to/photo.png" }

注意

  • ToAPIs 为第三方 API 平台(按量计费),获取 key:https://toapis.com/console/token
  • 上传上限 10MB,支持 jpg/png/webp/gif