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 🙏

© 2025 – Pkg Stats / Ryan Hefner

comfyui-client-sdk-nodejs

v1.0.7

Published

A comprehensive SDK for interacting with ComfyUI

Readme

ComfyUI Client SDK for Node.js

一个功能强大的 ComfyUI API 客户端 SDK,支持图像生成、背景移除等 AI 功能。

🚀 快速开始

安装

npm install comfyui-client-sdk-nodejs

基础使用

import { extractPic, APIClient } from "comfyui-client-sdk-nodejs";

// 背景移除功能
const imageUrls = ["https://example.com/image.jpg"];
const resultUrls = await extractPic(imageUrls);
console.log("处理结果:", resultUrls);

✨ 主要功能

🎨 智能背景移除

  • 批量图片处理
  • 自动图床上传
  • JSS OSS 集成
  • 高质量 BiRefNet 算法

🔧 完整 ComfyUI API

  • 工作流提交和管理
  • 图片上传下载
  • 系统状态监控
  • WebSocket 实时通信

📖 使用示例

背景移除

import { extractPic } from "comfyui-client-sdk-nodejs";

// 简单使用
const results = await extractPic(["https://example.com/image.jpg"]);

// 自定义配置
const config = {
  serverAddress: "localhost:8188",
  jssConfig: {
    endpoint: "your-endpoint",
    access_key: "your-key",
    secret_key: "your-secret",
    bucket: "your-bucket",
  },
};
const results = await extractPic(imageUrls, config);

ComfyUI API 使用

import { APIClient } from "comfyui-client-sdk-nodejs";

const client = new APIClient({
  serverAddress: "localhost:8188",
  clientId: "my-app",
});

await client.login("password");
const result = await client.queuePrompt(workflow);

🛠️ 项目集成

React 项目

import React, { useState } from "react";
import { extractPic } from "comfyui-client-sdk-nodejs";

function BackgroundRemover() {
  const [imageUrl, setImageUrl] = useState("");
  const [result, setResult] = useState("");

  const handleProcess = async () => {
    const results = await extractPic([imageUrl]);
    setResult(results[0]);
  };

  return (
    <div>
      <input value={imageUrl} onChange={(e) => setImageUrl(e.target.value)} />
      <button onClick={handleProcess}>移除背景</button>
      {result && <img src={result} alt="结果" />}
    </div>
  );
}

Node.js 服务

import express from "express";
import { extractPic } from "comfyui-client-sdk-nodejs";

const app = express();

app.post("/api/remove-background", async (req, res) => {
  try {
    const { imageUrls } = req.body;
    const results = await extractPic(imageUrls);
    res.json({ success: true, data: results });
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

⚙️ 配置选项

interface BackgroundRemovalConfig {
  serverAddress?: string; // ComfyUI 服务器地址
  password?: string; // 服务器密码
  enableLogging?: boolean; // 启用日志
  timeout?: number; // 超时时间
  jssConfig?: {
    // JSS OSS 配置
    endpoint: string;
    access_key: string;
    secret_key: string;
    bucket: string;
  };
}

📚 文档

🔧 开发

# 克隆项目
git clone <repository-url>
cd comfyui-client-sdk-nodejs

# 安装依赖
npm install

# 构建项目
npm run build

# 运行示例
node examples/background-removal-example.js

📦 发布到 NPM

使用脚本发布(推荐)

# 发布补丁版本 (1.0.4 → 1.0.5)
./scripts/publish.sh patch

# 发布小版本 (1.0.4 → 1.1.0)
./scripts/publish.sh minor

# 发布大版本 (1.0.4 → 2.0.0)
./scripts/publish.sh major

使用 npm 命令发布

# 快速发布补丁版本
npm run release:patch

# 快速发布小版本
npm run release:minor

# 快速发布大版本
npm run release:major

手动发布流程

# 1. 登录 NPM
npm login

# 2. 构建项目
npm run build

# 3. 更新版本并发布
npm version patch
npm publish

# 4. 推送标签到 git
git push --tags

详细发布指南请查看:NPM 发布指南

📋 系统要求

  • Node.js >= 16.0.0
  • TypeScript >= 4.5 (开发时)
  • ComfyUI 服务器

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License


需要帮助? 查看 使用指南 获取详细信息。