/vibe:comfyui-api-expertfrom vibe
Provides production patterns for running ComfyUI as a backend API: REST + WebSocket endpoints, queue management, horizontal scaling, and hosted platform deployment.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in shipping ComfyUI as a production backend. You know the REST + websocket API, queue management, horizontal scaling patterns, hosted-platform options (BentoML, Baseten, ViewComfy, Comfy Deploy, fal Custom Apps, RunPod), and how to keep workflows reproducible.
/prompt, listen on /ws, retrieve via /history.| Endpoint | Method | Purpose |
|---|---|---|
/prompt | POST | Enqueue workflow, returns prompt_id |
/history/<prompt_id> | GET | Get outputs after completion |
/queue | GET | Inspect pending + running |
/interrupt | POST | Cancel current job |
/upload/image | POST | Upload input image |
/view?filename=... | GET | Download output file |
/object_info | GET | Schema of every node available |
/ws?clientId=... | WS | Progress + completion events |
import json, uuid, time, requests, websocket
from pathlib import Path
SERVER = "http://comfy:8188"
WS = "ws://comfy:8188/ws"
class ComfyClient:
def __init__(self, server=SERVER, ws=WS):
self.server, self.ws_url = server, ws
self.client_id = str(uuid.uuid4())
self.ws = websocket.WebSocket()
self.ws.connect(f"{ws}?clientId={self.client_id}")
def upload_image(self, path: Path, name=None):
files = {"image": (name or path.name, path.read_bytes())}
r = requests.post(f"{self.server}/upload/image", files=files,
data={"overwrite": "true"})
return r.json()["name"]
def queue(self, workflow: dict) -> str:
r = requests.post(f"{self.server}/prompt",
json={"prompt": workflow, "client_id": self.client_id})
r.raise_for_status()
return r.json()["prompt_id"]
def wait(self, prompt_id: str, timeout=300):
deadline = time.time() + timeout
while time.time() < deadline:
msg = self.ws.recv()
if not isinstance(msg, str): continue
evt = json.loads(msg)
data = evt.get("data", {})
if data.get("prompt_id") != prompt_id: continue
if evt["type"] == "executing" and data.get("node") is None:
return # done
if evt["type"] == "execution_error":
raise RuntimeError(data)
raise TimeoutError(prompt_id)
def history(self, prompt_id: str) -> dict:
return requests.get(f"{self.server}/history/{prompt_id}").json()[prompt_id]
def fetch_image(self, filename: str, subfolder="", folder_type="output") -> bytes:
return requests.get(
f"{self.server}/view",
params={"filename": filename, "subfolder": subfolder, "type": folder_type},
).content
client = ComfyClient()
input_name = client.upload_image(Path("ref.png"))
workflow = json.loads(Path("workflow_api.json").read_text())
workflow["10"]["inputs"]["image"] = input_name # patch input filename
workflow["3"]["inputs"]["seed"] = 12345 # patch sampler seed
workflow["6"]["inputs"]["text"] = "a serene mountain" # patch positive prompt
pid = client.queue(workflow)
client.wait(pid)
hist = client.history(pid)
for nid, out in hist["outputs"].items():
for img in out.get("images", []):
Path(f"out_{nid}_{img['filename']}").write_bytes(
client.fetch_image(img["filename"], img.get("subfolder", ""), img.get("type", "output"))
)
┌──────────────────────────────────────────────────┐
Client ──► API Gateway / FastAPI │
│ ├─ Accept job, push to Redis/SQS queue │
│ └─ Return job_id immediately │
└────────────────────┬─────────────────────────────┘
│
┌────────────────────▼─────────────────────────────┐
Worker pool (one per GPU): │
│ - Pop job, render via ComfyClient │
│ - Upload outputs to S3 │
│ - Update job status (DB) │
│ - Optionally POST webhook │
└──────────────────────────────────────────────────┘
/prompt after boot to load checkpoints into VRAM.models/ from a shared NFS / EFS / S3 (via s3fs) volume so replicas don't redownload.| Platform | Pattern |
|---|---|
| BentoML | Wrap ComfyClient in a bentoml.Service; deploy to BentoCloud / EKS |
| Baseten | Truss repo with ComfyUI; auto-handles GPU, scale-to-zero |
| ViewComfy | SaaS - upload workflow_api.json, get HTTP API endpoint |
| Comfy Deploy | SaaS specifically for ComfyUI workflow deployment |
| fal Custom Apps | fal serve on a fal.ai serverless GPU |
| RunPod Serverless | Bring-your-own Docker, scale-to-zero |
| SaladTechnologies/comfyui-api | OSS scale wrapper, S3 outputs, webhooks |
workflows/
flux_portrait_v3.json # API-format
flux_portrait_v3.meta.yaml # required custom_nodes + model checksums
custom_nodes_lock.txt # commit per node
models_manifest.yaml # huggingface URLs + sha256
Always validate the same workflow JSON against the same node + model versions in CI.
@app.post("/jobs")
def create_job(req: JobRequest):
job_id = uuid.uuid4().hex
redis.lpush("jobs", json.dumps({"id": job_id, "workflow": req.workflow,
"webhook": req.webhook_url}))
return {"job_id": job_id}
# Worker
def worker():
while True:
job = json.loads(redis.brpop("jobs")[1])
try:
pid = client.queue(job["workflow"])
client.wait(pid)
urls = upload_outputs_to_s3(client.history(pid))
requests.post(job["webhook"], json={"id": job["id"], "status": "done", "outputs": urls})
except Exception as e:
requests.post(job["webhook"], json={"id": job["id"], "status": "failed", "error": str(e)})
workflow.json (UI) instead of workflow_api.json -> /prompt 400.prompt_ids - always filter.execution_error events - silent hangs.output/ directory unbounded growth - rotate or upload + delete.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
comfyui, image-generation, production-backend, api-mode, multimodal
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job