跳到正文
Skillpedia
API 与服务器(后端)48k · #4210

comfyui-gateway

它能做什么

这项服务相当于 ComfyUI 的“守门人”。ComfyUI 是一个能根据文字生成图片的程序。它负责安排图片生成任务,确保 ComfyUI 不会超负荷运行,并让其他程序能够安全地与它通信。

适用场景

  • ✓当你希望程序自动生成大量图片时。
  • ✓当你需要对图片生成任务进行组织和排序时。
  • ✓当你希望 ComfyUI 生成完一张图片后通知其他程序时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/comfyui-gateway/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/comfyui-gateway/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“使用 'cute_cat' 模型生成 10 张猫的图片,完成后通知我。”

每周 5 个新技能,1 分钟读完。

工作原理

它会接收图片生成请求,先放入队列,以避免 ComfyUI 超负荷,然后再把任务发送给 ComfyUI 处理。它还可以保存生成的图片,并通知其他程序。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

ComfyUI Gateway

Overview

REST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).

When to Use This Skill

  • When the user mentions "comfyui" or related topics
  • When the user mentions "comfy ui" or related topics
  • When the user mentions "stable diffusion api gateway" or related topics
  • When the user mentions "gateway comfyui" or related topics
  • When the user mentions "api gateway imagens" or related topics
  • When the user mentions "queue imagens" or related topics

Do Not Use This Skill When

  • The task is unrelated to comfyui gateway
  • A simpler, more specific tool can handle the request
  • The user needs general-purpose assistance without domain expertise

How It Works

A production-grade REST API gateway that transforms any ComfyUI server into a universal, secure, and scalable service. Supports workflow templates with placeholders, job queuing with priorities, webhook callbacks, result caching, and multiple storage backends.

Architecture Overview

┌─────────────┐     ┌──────────────────────────────────┐     ┌──────────┐
│   Clients    │────▶│        ComfyUI Gateway           │────▶│ ComfyUI  │
│ (curl, n8n,  │     │                                  │     │ Server   │
│  Claude,     │     │  ┌─────────┐  ┌──────────────┐  │     │ (local/  │
│  Lovable,    │     │  │ Fastify │  │ BullMQ Queue │  │     │  remote) │
│  Supabase)   │     │  │ API     │──│ (or in-mem)  │  │     └──────────┘
│              │◀────│  └─────────┘  └──────────────┘  │
│              │     │  ┌─────────┐  ┌──────────────┐  │     ┌──────────┐
│              │     │  │ Auth +  │  │ Storage      │  │────▶│ S3/MinIO │
│              │     │  │ RateL.  │  │ (local/S3)   │  │     │(optional)│
│              │     │  └─────────┘  └──────────────┘  │     └──────────┘
└─────────────┘     └──────────────────────────────────┘

Components

Component Purpose File(s)
API Gateway REST endpoints, validation, CORS src/api/
Worker Processes jobs, talks to ComfyUI src/worker/
ComfyUI Client HTTP + WebSocket to ComfyUI src/comfyui/
Workflow Manager Template storage, placeholder rendering src/workflows/
Storage Provider Local disk + S3-compatible src/storage/
Cache Hash-based deduplication src/cache/
Notifier Webhook with HMAC signing src/notifications/
Auth API key + JWT + rate limiting src/auth/
DB SQLite (better-sqlite3) or Postgres src/db/
CLI Init, add-workflow, run, worker src/cli/

Quick Start


## 1. Install

cd comfyui-gateway
npm install

## 2. Configure

cp .env.example .env

## 3. Initialize

npx tsx src/cli/index.ts init

## 4. Add A Workflow

npx tsx src/cli/index.ts add-workflow ./workflows/sdxl_realism_v1.json \
  --id sdxl_realism_v1 --schema ./workflows/sdxl_realism_v1.schema.json

## 5. Start (Api + Worker In One Process)

npm run dev

## Or Separately:

npm run start:api   # API only
npm run start:worker # Worker only

Environment Variables

All configuration is via .env — nothing is hardcoded:

Variable Default Description
PORT 3000 API server port
HOST 0.0.0.0 API bind address
COMFYUI_URL http://127.0.0.1:8188 ComfyUI server URL
COMFYUI_TIMEOUT_MS 300000 Max wait for ComfyUI (5min)
API_KEYS "" Comma-separated API keys (key:role)
JWT_SECRET "" JWT signing secret (empty = JWT disabled)
REDIS_URL "" Redis URL (empty = in-memory queue)
DATABASE_URL ./data/gateway.db SQLite path or Postgres URL
STORAGE_PROVIDER local local or s3
STORAGE_LOCAL_PATH ./data/outputs Local output directory
S3_ENDPOINT "" S3/MinIO endpoint
S3_BUCKET "" S3 bucket name
S3_ACCESS_KEY "" S3 access key
S3_SECRET_KEY "" S3 secret key
S3_REGION us-east-1 S3 region
WEBHOOK_SECRET "" HMAC signing secret for webhooks
WEBHOOK_ALLOWED_DOMAINS * Comma-separated allowed callback domains
MAX_CONCURRENCY 1 Parallel jobs per GPU
MAX_IMAGE_SIZE 2048 Maximum dimension (width or height)
MAX_BATCH_SIZE 4 Maximum batch size
CACHE_ENABLED true Enable result caching

…

常见问题

什么是 ComfyUI?

它是一个利用人工智能根据文字描述生成图片的程序。

这个“网关”有什么用?

它可以帮助管理和组织图片生成请求,让通过其他程序使用 ComfyUI 的人,流程更高效、更安全。

我可以用它生成任何类型的图片吗?

可以,前提是 ComfyUI 已经配置了生成你所需图片类型所需的模型和工具。

详情

作者的原始描述

REST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4210
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能