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

comfyui-openai-images-api

v1.0.1

Published

OpenAI 兼容的图片生成 API,后端使用 ComfyUI + SDXL Turbo

Readme

🚀 ComfyUI OpenAI Images API

把你的本地 ComfyUI + SDXL Turbo 变成 OpenAI 兼容的图片生成服务

一句话:装上就能用,任何兼容 OpenAI 图片 API 的工具都能直接调用你本地的 ComfyUI。


🎯 这是什么?

一个开箱即用的 Node.js CLI 工具,把你的本地 ComfyUI(搭配 SDXL Turbo 模型)包装成一个完全兼容 OpenAI /v1/images/generations 接口的 API 服务。

  • ✅ 任何支持 OpenAI 图片生成 API 的工具都可以直接指向你的本地服务
  • ✅ 不需要翻墙、不需要 API Key、不计费
  • ✅ SDXL Turbo 超高速出图,4 步采样,秒级生成
  • ✅ 自带 Web 管理后台:看日志、改配置、管理图片
  • ✅ 隐私安全:所有数据都在你自己电脑上

✨ 功能一览

| 功能 | 说明 | |---|---| | OpenAI 兼容接口 | POST /v1/images/generations | | SDXL Turbo 工作流 | 预置 4 步采样、低 CFG 调优 | | CLI 命令行 | comfyui-img serve/generate/config/status | | Web 管理后台 | 配置/日志/图片管理 | | 自动配置持久化 | ~/.config/comfyui-openai-images-api/ | | 图片代理 + Base64 | URL 和 b64_json 双格式支持 |

📦 安装

前提条件

  1. ComfyUI 已运行(默认 http://127.0.0.1:8188
  2. SDXL Turbo 模型已下载
  3. Node.js >= 18

npm 全局安装

npm install -g comfyui-openai-images-api

或克隆仓库

git clone https://github.com/your/comfyui-openai-images-api.git
cd comfyui-openai-images-api
npm install
npm link

🚀 快速上手

1️⃣ 启动服务

comfyui-img serve

2️⃣ 调用 API(curl 或其他 OpenAI 客户端)

curl http://localhost:3000/v1/images/generations \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a cute cat","n":1,"size":"512x512"}'

3️⃣ 管理后台

打开 http://localhost:3000/admin

4️⃣ CLI 命令

comfyui-img status                    # 检查 ComfyUI 状态
comfyui-img config                    # 列出配置
comfyui-img config --get port         # 查看单个配置
comfyui-img config --set port=8080    # 修改配置
comfyui-img generate "prompt" -o out.png  # 一键生成

🔧 配置项

| 配置项 | 默认值 | 说明 | |---|---|---| | comfyuiUrl | http://127.0.0.1:8188 | ComfyUI 地址 | | port | 3000 | 监听端口 | | defaultSize | 512x512 | 默认尺寸 | | defaultModel | sd_xl_turbo_1.0_fp16.safetensors | 模型名 | | steps | 4 | 采样步数 | | cfg | 2 | CFG 尺度 |

🏗️ 项目架构

comfyui-openai-images-api/
├── bin/cli.js                    # CLI 入口
├── src/
│   ├── server.js                 # Express 服务器
│   ├── config.js                 # 配置管理
│   ├── logger.js                 # Winston 日志
│   ├── services/comfyui.js       # ComfyUI 交互
│   ├── routes/v1.js              # OpenAI 兼容 API
│   ├── routes/admin.js           # 管理后台 API
│   ├── workflows/sdxl-turbo.json # 工作流模板
│   └── admin/public/             # 管理后台前端
├── package.json
└── README.md

📄 开源协议

MIT License