[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JNH23BBA5RPD4JP77AD5HY":3,"skill-same:01M6JNH23BBA5RPD4JP77AD5HY":98},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":60,"ownerDescription":6,"updatedAt":61,"install":62,"resources":75},"01M6JNH23BBA5RPD4JP77AD5HY","comfyui_gateway",null,"REST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).","LongLeo287\u002FOmniClaw","LongLeo287","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F141803367?v=4","01M6JK75C62VCNZKR5BRZ386YV","LongLeo","01M6JK75GQ78TSP1ZPXNKK3MCH",9,"MIT","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"comfyui gateway","gateway","comfyui","api-gateway","URL","caching","delivery","community","image-generation","webhooks","api","image","base64","api gateway","code","auth","workflow","typescript","safe","cli","2026-11-10 10:12:30",false,"---\nname: comfyui_gateway\n\ndescription: REST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).\nrisk: safe\nsource: community\ndate_added: '2026-03-06'\nauthor: renat\ntags:\n- comfyui\n- api-gateway\n- image-generation\n- typescript\ntools:\n- claude-code\n- antigravity\n- cursor\n- gemini-cli\n- codex-cli\n---\n\n# ComfyUI Gateway\n\n## Overview\n\nREST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).\n\n## When to Use This Skill\n\n- When the user mentions \"comfyui\" or related topics\n- When the user mentions \"comfy ui\" or related topics\n- When the user mentions \"stable diffusion api gateway\" or related topics\n- When the user mentions \"gateway comfyui\" or related topics\n- When the user mentions \"api gateway imagens\" or related topics\n- When the user mentions \"queue imagens\" or related topics\n\n## Do Not Use This Skill When\n\n- The task is unrelated to comfyui gateway\n- A simpler, more specific tool can handle the request\n- The user needs general-purpose assistance without domain expertise\n\n## How It Works\n\nA production-grade REST API gateway that transforms any ComfyUI server into a universal,\nsecure, and scalable service. Supports workflow templates with placeholders, job queuing\nwith priorities, webhook callbacks, result caching, and multiple storage backends.\n\n## Architecture Overview\n\n```\n┌─────────────┐     ┌──────────────────────────────────┐     ┌──────────┐\n│   Clients    │────▶│        ComfyUI Gateway           │────▶│ ComfyUI  │\n│ (curl, n8n,  │     │                                  │     │ Server   │\n│  Claude,     │     │  ┌─────────┐  ┌──────────────┐  │     │ (local\u002F  │\n│  Lovable,    │     │  │ Fastify │  │ BullMQ Queue │  │     │  remote) │\n│  Supabase)   │     │  │ API     │──│ (or in-mem)  │  │     └──────────┘\n│              │◀────│  └─────────┘  └──────────────┘  │\n│              │     │  ┌─────────┐  ┌──────────────┐  │     ┌──────────┐\n│              │     │  │ Auth +  │  │ Storage      │  │────▶│ S3\u002FMinIO │\n│              │     │  │ RateL.  │  │ (local\u002FS3)   │  │     │(optional)│\n│              │     │  └─────────┘  └──────────────┘  │     └──────────┘\n└─────────────┘     └──────────────────────────────────┘\n```\n\n## Components\n\n| Component | Purpose | File(s) |\n|-----------|---------|---------|\n| **API Gateway** | REST endpoints, validation, CORS | `src\u002Fapi\u002F` |\n| **Worker** | Processes jobs, talks to ComfyUI | `src\u002Fworker\u002F` |\n| **ComfyUI Client** | HTTP + WebSocket to ComfyUI | `src\u002Fcomfyui\u002F` |\n| **Workflow Manager** | Template storage, placeholder rendering | `src\u002Fworkflows\u002F` |\n| **Storage Provider** | Local disk + S3-compatible | `src\u002Fstorage\u002F` |\n| **Cache** | Hash-based deduplication | `src\u002Fcache\u002F` |\n| **Notifier** | Webhook with HMAC signing | `src\u002Fnotifications\u002F` |\n| **Auth** | API key + JWT + rate limiting | `src\u002Fauth\u002F` |\n| **DB** | SQLite (better-sqlite3) or Postgres | `src\u002Fdb\u002F` |\n| **CLI** | Init, add-workflow, run, worker | `src\u002Fcli\u002F` |\n\n## Quick Start\n\n```bash\n\n## 1. Install\n\ncd comfyui-gateway\nnpm install\n\n## 2. Configure\n\ncp .env.example .env\n\n## 3. Initialize\n\nnpx tsx src\u002Fcli\u002Findex.ts init\n\n## 4. Add A Workflow\n\nnpx tsx src\u002Fcli\u002Findex.ts add-workflow .\u002Fworkflows\u002Fsdxl_realism_v1.json \\\n  --id sdxl_realism_v1 --schema .\u002Fworkflows\u002Fsdxl_realism_v1.schema.json\n\n## 5. Start (Api + Worker In One Process)\n\nnpm run dev\n\n## Or Separately:\n\nnpm run start:api   # API only\nnpm run start:worker # Worker only\n```\n\n## Environment Variables\n\nAll configuration is via `.env` — nothing is hardcoded:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `PORT` | `3000` | API server port |\n| `HOST` | `0.0.0.0` | API bind address |\n| `COMFYUI_URL` | `http:\u002F\u002F127.0.0.1:8188` | ComfyUI server URL |\n| `COMFYUI_TIMEOUT_MS` | `300000` | Max wait for ComfyUI (5min) |\n| `API_KEYS` | `\"\"` | Comma-separated API keys (`key:role`) |\n| `JWT_SECRET` | `\"\"` | JWT signing secret (empty = JWT disabled) |\n| `REDIS_URL` | `\"\"` | Redis URL (empty = in-memory queue) |\n| `DATABASE_URL` | `.\u002Fdata\u002Fgateway.db` | SQLite path or Postgres URL |\n| `STORAGE_PROVIDER` | `local` | `local` or `s3` |\n| `STORAGE_LOCAL_PATH` | `.\u002Fdata\u002Foutputs` | Local output directory |\n| `S3_ENDPOINT` | `\"\"` | S3\u002FMinIO endpoint |\n| `S3_BUCKET` | `\"\"` | S3 bucket name |\n| `S3_ACCESS_KEY` | `\"\"` | S3 access key |\n| `S3_SECRET_KEY` | `\"\"` | S3 secret key |\n| `S3_REGION` | `us-east-1` | S3 region |\n| `WEBHOOK_SECRET` | `\"\"` | HMAC signing secret for webhooks |\n| `WEBHOOK_ALLOWED_DOMAINS` | `*` | Comma-separated allowed callback domains |\n| `MAX_CONCURRENCY` | `1` | Parallel jobs per GPU |\n| `MAX_IMAGE_SIZE` | `2048` | Maximum dimension (width or height) |\n| `MAX_BATCH_SIZE` | `4` | Maximum batch size |\n| `CACHE_ENABLED` | `true` | Enable result caching |\n| `CACHE_TTL_SECONDS` | `86400` | Cache TTL (24h) |\n| `RATE_LIMIT_MAX` | `100` | Requests per window |\n| `RATE_LIMIT_WINDOW_MS` | `60000` | Rate limit window (1min) |\n| `LOG_LEVEL` | `info` | Pino log level |\n| `PRIVACY_MODE` | `false` | Redact prompts from logs |\n| `CORS_ORIGINS` | `*` | Allowed CORS origins |\n| `NODE_ENV` | `development` | Environment |\n\n## Health & Capabilities\n\n```\nGET \u002Fhealth\n→ { ok: true, version, comfyui: { reachable, url, models? }, uptime }\n\nGET \u002Fcapabilities\n→ { workflows: [...], maxSize, maxBatch, formats, storageProvider }\n```\n\n## Workflows (Crud)\n\n```\nGET    \u002Fworkflows            → list all workflows\nPOST   \u002Fworkflows            → register new workflow\nGET    \u002Fworkflows\u002F:id        → workflow details + input schema\nPUT    \u002Fworkflows\u002F:id        → update workflow\nDELETE \u002Fworkflows\u002F:id        → remove workflow\n```\n\n## Jobs\n\n```\nPOST   \u002Fjobs                 → create job (returns jobId immediately)\nGET    \u002Fjobs\u002F:jobId          → status + progress + outputs\nGET    \u002Fjobs\u002F:jobId\u002Flogs     → sanitized execution logs\nPOST   \u002Fjobs\u002F:jobId\u002Fcancel   → request cancellation\nGET    \u002Fjobs                 → list jobs (filters: status, workflowId, after, before, limit)\n```\n\n## Outputs\n\n```\nGET    \u002Foutputs\u002F:jobId       → list output files + metadata\nGET    \u002Foutputs\u002F:jobId\u002F:file → download\u002Fstream file\n```\n\n## Job Lifecycle\n\n```\nqueued → running → succeeded\n                 → failed\n                 → canceled\n```\n\n1. Client POSTs to `\u002Fjobs` with workflowId + inputs\n2. Gateway validates, checks cache, checks idempotency\n3. If cache hit → returns existing outputs immediately (status: `cache_hit`)\n4. Otherwise → enqueues job, returns `jobId` + `pollUrl`\n5. Worker picks up job, renders workflow template, submits to ComfyUI\n6. Worker polls ComfyUI for progress (or listens via WebSocket)\n7. On completion → downloads outputs, stores them, updates DB\n8. If callbackUrl → sends signed webhook POST\n9. Client polls `\u002Fjobs\u002F:jobId` or receives webhook\n\n## Workflow Templates\n\nWorkflows are ComfyUI JSON with `{{placeholder}}` tokens. The gateway resolves\nthese at runtime using the job's `inputs` and `params`:\n\n```json\n{\n  \"3\": {\n    \"class_type\": \"KSampler\",\n    \"inputs\": {\n      \"seed\": \"{{seed}}\",\n      \"steps\": \"{{steps}}\",\n      \"cfg\": \"{{cfg}}\",\n      \"sampler_name\": \"{{sampler}}\",\n      \"scheduler\": \"normal\",\n      \"denoise\": 1,\n      \"model\": [\"4\", 0],\n      \"positive\": [\"6\", 0],\n      \"negative\": [\"7\", 0],\n      \"latent_image\": [\"5\", 0]\n    }\n  },\n  \"6\": {\n    \"class_type\": \"CLIPTextEncode\",\n    \"inputs\": {\n      \"text\": \"{{prompt}}\",\n      \"clip\": [\"4\", 1]\n    }\n  }\n}\n```\n\nEach workflow has an `inputSchema` (Zod) that validates what the client sends.\n\n## Security Model\n\n- **API Keys**: `X-API-Key` header; keys configured via `API_KEYS` env var as `key1:admin,key2:user`\n- **JWT**: Optional; when `JWT_SECRET` is set, accepts `Authorization: Bearer \u003Ctoken>`\n- **Roles**: `admin` (full CRUD on workflows + jobs), `user` (create jobs, read own jobs)\n- **Rate Limiting**: Per key + per IP, configurable window and max\n- **Webhook Security**: HMAC-SHA256 signature in `X-Signature` header\n- **Callback Allowlist**: Only approved domains receive webhooks\n- **Privacy Mode**: When enabled, prompts are redacted from logs and DB\n- **Idempotency**: `metadata.requestId` prevents duplicate processing\n- **CORS**: Configurable allowed origins\n- **Input Validation**: Zod schemas on every endpoint; max size\u002Fbatch enforced\n\n## Comfyui Integration\n\nThe gateway communicates with ComfyUI via its native HTTP API:\n\n| ComfyUI Endpoint | Gateway Usage |\n|------------------|---------------|\n| `POST \u002Fprompt` | Submit rendered workflow |\n| `GET \u002Fhistory\u002F{id}` | Poll job completion |\n| `GET \u002Fview?filename=...` | Download generated images |\n| `GET \u002Fobject_info` | Discover available nodes\u002Fmodels |\n| `WS \u002Fws?clientId=...` | Real-time progress (optional) |\n\nThe client auto-detects ComfyUI version and adapts:\n- Tries WebSocket first for progress, falls back to polling\n- Handles both `\u002Fhistory` response formats\n- Detects OOM errors and classifies them with recommendations\n\n## Cache Strategy\n\nCache key = SHA-256 of `workflowId + sorted(inputs) + sorted(params) + checkpoint`.\nOn cache hit, the gateway returns a \"virtual\" job with pre-existing outputs — no GPU\ncomputation needed. Cache is stored alongside job data in the DB with configurable TTL.\n\n## Error Classification\n\n| Error Code | Meaning | Retry? |\n|------------|---------|--------|\n| `COMFYUI_UNREACHABLE` | Cannot connect to ComfyUI | Yes (with backoff) |\n| `COMFYUI_OOM` | Out of memory on GPU | No (reduce dimensions) |\n| `COMFYUI_TIMEOUT` | Execution exceeded timeout | Maybe (increase timeout) |\n| `COMFYUI_NODE_ERROR` | Node execution failed | No (check workflow) |\n| `VALIDATION_ERROR` | Invalid inputs | No (fix request) |\n| `WORKFLOW_NOT_FOUND` | Unknown workflowId | No (register workflow) |\n| `RATE_LIMITED` | Too many requests | Yes (wait) |\n| `AUTH_FAILED` | Invalid\u002Fmissing credentials | No (fix auth) |\n| `CACHE_HIT` | (Not an error) Served from cache | N\u002FA |\n\n## Bundled Workflows\n\nThree production-ready workflow templates are included:\n\n## 1. `Sdxl_Realism_V1` — Photorealistic Generation\n\n- Checkpoint: SDXL base\n- Optimized for: Portraits, landscapes, product shots\n- Default: 1024x1024, 30 steps, cfg 7.0\n\n## 2. `Sprite_Transparent_Bg` — Game Sprites With Alpha\n\n- Checkpoint: SD 1.5 or SDXL\n- Optimized for: 2D game assets, transparent backgrounds\n- Default: 512x512, 25 steps, cfg 7.5\n\n## 3. `Icon_512` — App Icons With Optional Upscale\n\n- Checkpoint: SDXL base\n- Optimized for: Square icons, clean edges\n- Default: 512x512, 20 steps, cfg 6.0, optional 2x upscale\n\n## Observability\n\n- **Structured Logs**: Pino JSON logs with `correlationId` on every request\n- **Metrics**: Jobs queued\u002Frunning\u002Fsucceeded\u002Ffailed, avg processing time, cache hit rate\n- **Audit Log**: Admin actions (workflow CRUD, key management) logged with timestamp + actor\n\n## Cli Reference\n\n```bash\nnpx tsx src\u002Fcli\u002Findex.ts init                    # Create dirs, .env.example\nnpx tsx src\u002Fcli\u002Findex.ts add-workflow \u003Cfile>      # Register workflow template\n  --id \u003Cid> --name \u003Cname> --schema \u003Cschema.json>\nnpx tsx src\u002Fcli\u002Findex.ts list-workflows           # Show registered workflows\nnpx tsx src\u002Fcli\u002Findex.ts run                      # Start API server\nnpx tsx src\u002Fcli\u002Findex.ts worker                   # Start job worker\nnpx tsx src\u002Fcli\u002Findex.ts health                   # Check ComfyUI connectivity\n```\n\n## Troubleshooting\n\nRead `references\u002Ftroubleshooting.md` for detailed guidance on:\n- ComfyUI not reachable (firewall, wrong port, Docker networking)\n- OOM errors (reduce resolution, batch, or steps)\n- Slow generation (GPU utilization, queue depth, model loading)\n- Webhook failures (DNS, SSL, timeout, domain allowlist)\n- Redis connection issues (fallback to in-memory)\n- Storage permission errors (local path, S3 credentials)\n\n## Integration Examples\n\nRead `references\u002Fintegration.md` for ready-to-use examples with:\n- curl commands for every endpoint\n- n8n webhook workflow\n- Supabase Edge Function caller\n- Claude Code \u002F Claude.ai integration\n- Python requests client\n- JavaScript fetch client\n\n## File Structure\n\n```\ncomfyui-gateway\u002F\n├── SKILL.md\n├── package.json\n├── tsconfig.json\n├── .env.example\n├── src\u002F\n│   ├── api\u002F\n│   │   ├── server.ts          # Fastify setup + plugins\n│   │   ├── routes\u002F\n│   │   │   ├── health.ts      # GET \u002Fhealth, \u002Fcapabilities\n│   │   │   ├── workflows.ts   # CRUD \u002Fworkflows\n│   │   │   ├── jobs.ts        # CRUD \u002Fjobs\n│   │   │   └── outputs.ts     # GET \u002Foutputs\n│   │   ├── middleware\u002F\n│   │   │   └── error-handler.ts\n│   │   └── plugins\u002F\n│   │       ├── auth.ts        # API key + JWT\n│   │       ├── rate-limit.ts\n│   │       └── cors.ts\n│   ├── worker\u002F\n│   │   └── processor.ts       # Job processor\n│   ├── comfyui\u002F\n│   │   └── client.ts          # ComfyUI HTTP + WS client\n│   ├── storage\u002F\n│   │   ├── index.ts           # Provider factory\n│   │   ├── local.ts           # Local filesystem\n│   │   └── s3.ts              # S3-compatible\n│   ├── workflows\u002F\n│   │   └── manager.ts         # Template CRUD + rendering\n│   ├── cache\u002F\n│   │   └── index.ts           # Hash-based cache\n│   ├── notifications\u002F\n│   │   └── webhook.ts         # HMAC-signed callbacks\n│   ├── auth\u002F\n│   │   └── index.ts           # Key\u002FJWT validation + roles\n│   ├── db\u002F\n│   │   ├── index.ts           # DB factory (SQLite\u002FPostgres)\n│   │   └── migrations.ts      # Schema creation\n│   ├── cli\u002F\n│   │   └── index.ts           # CLI commands\n│   ├── utils\u002F\n│   │   ├── config.ts          # Env loading + validation\n│   │   ├── errors.ts          # Error classes\n│   │   ├── logger.ts          # Pino setup\n│   │   └── hash.ts            # SHA-256 hashing\n│   └── index.ts               # Main entrypoint\n├── config\u002F\n│   └── workflows\u002F             # Bundled workflow templates\n│       ├── sdxl_realism_v1.json\n│       ├── sdxl_realism_v1.schema.json\n│       ├── sprite_transparent_bg.json\n│       ├── sprite_transparent_bg.schema.json\n│       ├── icon_512.json\n│       └── icon_512.schema.json\n├── data\u002F\n│   ├── outputs\u002F               # Generated images\n│   ├── workflows\u002F             # User-added wor\n\n## Best Practices\n\n- Provide clear, specific context about your project and requirements\n- Review all suggestions before applying them to production code\n- Combine with other complementary skills for comprehensive analysis\n\n## Common Pitfalls\n\n- Using this skill for tasks outside its domain expertise\n- Applying recommendations without understanding your specific context\n- Not providing enough project context for accurate analysis\n\n## Related Skills\n\n- `ai-studio-image` - Complementary skill for enhanced analysis\n- `image-studio` - Complementary skill for enhanced analysis\n- `stability-ai` - Complementary skill for enhanced analysis\n","# ComfyUI Gateway\n\n## Overview\n\nREST API gateway for ComfyUI servers. Workflow management, job queuing, webhooks, caching, auth, rate limiting, and image delivery (URL + base64).\n\n## When to Use This Skill\n\n- When the user mentions \"comfyui\" or related topics\n- When the user mentions \"comfy ui\" or related topics\n- When the user mentions \"stable diffusion api gateway\" or related topics\n- When the user mentions \"gateway comfyui\" or related topics\n- When the user mentions \"api gateway imagens\" or related topics\n- When the user mentions \"queue imagens\" or related topics\n\n## Do Not Use This Skill When\n\n- The task is unrelated to comfyui gateway\n- A simpler, more specific tool can handle the request\n- The user needs general-purpose assistance without domain expertise\n\n## How It Works\n\nA production-grade REST API gateway that transforms any ComfyUI server into a universal,\nsecure, and scalable service. Supports workflow templates with placeholders, job queuing\nwith priorities, webhook callbacks, result caching, and multiple storage backends.\n\n## Architecture Overview\n\n```\n┌─────────────┐     ┌──────────────────────────────────┐     ┌──────────┐\n│   Clients    │────▶│        ComfyUI Gateway           │────▶│ ComfyUI  │\n│ (curl, n8n,  │     │                                  │     │ Server   │\n│  Claude,     │     │  ┌─────────┐  ┌──────────────┐  │     │ (local\u002F  │\n│  Lovable,    │     │  │ Fastify │  │ BullMQ Queue │  │     │  remote) │\n│  Supabase)   │     │  │ API     │──│ (or in-mem)  │  │     └──────────┘\n│              │◀────│  └─────────┘  └──────────────┘  │\n│              │     │  ┌─────────┐  ┌──────────────┐  │     ┌──────────┐\n│              │     │  │ Auth +  │  │ Storage      │  │────▶│ S3\u002FMinIO │\n│              │     │  │ RateL.  │  │ (local\u002FS3)   │  │     │(optional)│\n│              │     │  └─────────┘  └──────────────┘  │     └──────────┘\n└─────────────┘     └──────────────────────────────────┘\n```\n\n## Components\n\n| Component | Purpose | File(s) |\n|-----------|---------|---------|\n| **API Gateway** | REST endpoints, validation, CORS | `src\u002Fapi\u002F` |\n| **Worker** | Processes jobs, talks to ComfyUI | `src\u002Fworker\u002F` |\n| **ComfyUI Client** | HTTP + WebSocket to ComfyUI | `src\u002Fcomfyui\u002F` |\n| **Workflow Manager** | Template storage, placeholder rendering | `src\u002Fworkflows\u002F` |\n| **Storage Provider** | Local disk + S3-compatible | `src\u002Fstorage\u002F` |\n| **Cache** | Hash-based deduplication | `src\u002Fcache\u002F` |\n| **Notifier** | Webhook with HMAC signing | `src\u002Fnotifications\u002F` |\n| **Auth** | API key + JWT + rate limiting | `src\u002Fauth\u002F` |\n| **DB** | SQLite (better-sqlite3) or Postgres | `src\u002Fdb\u002F` |\n| **CLI** | Init, add-workflow, run, worker | `src\u002Fcli\u002F` |\n\n## Quick Start\n\n```bash\n\n## 1. Install\n\ncd comfyui-gateway\nnpm install\n\n## 2. Configure\n\ncp .env.example .env\n\n## 3. Initialize\n\nnpx tsx src\u002Fcli\u002Findex.ts init\n\n## 4. Add A Workflow\n\nnpx tsx src\u002Fcli\u002Findex.ts add-workflow .\u002Fworkflows\u002Fsdxl_realism_v1.json \\\n  --id sdxl_realism_v1 --schema .\u002Fworkflows\u002Fsdxl_realism_v1.schema.json\n\n## 5. Start (Api + Worker In One Process)\n\nnpm run dev\n\n## Or Separately:\n\nnpm run start:api   # API only\nnpm run start:worker # Worker only\n```\n\n## Environment Variables\n\nAll configuration is via `.env` — nothing is hardcoded:\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `PORT` | `3000` | API server port |\n| `HOST` | `0.0.0.0` | API bind address |\n| `COMFYUI_URL` | `http:\u002F\u002F127.0.0.1:8188` | ComfyUI server URL |\n| `COMFYUI_TIMEOUT_MS` | `300000` | Max wait for ComfyUI (5min) |\n| `API_KEYS` | `\"\"` | Comma-separated API keys (`key:role`) |\n| `JWT_SECRET` | `\"\"` | JWT signing secret (empty = JWT disabled) |\n| `REDIS_URL` | `\"\"` | Redis URL (empty = in-memory queue) |\n| `DATABASE_URL` | `.\u002Fdata\u002Fgateway.db` | SQLite path or Postgres URL |\n| `STORAGE_PROVIDER` | `local` | `local` or `s3` |\n| `STORAGE_LOCAL_PATH` | `.\u002Fdata\u002Foutputs` | Local output directory |\n| `S3_ENDPOINT` | `\"\"` | S3\u002FMinIO endpoint |\n| `S3_BUCKET` | `\"\"` | S3 bucket name |\n| `S3_ACCESS_KEY` | `\"\"` | S3 access key |\n| `S3_SECRET_KEY` | `\"\"` | S3 secret key |\n| `S3_REGION` | `us-east-1` | S3 region |\n| `WEBHOOK_SECRET` | `\"\"` | HMAC signing secret for webhooks |\n| `WEBHOOK_ALLOWED_DOMAINS` | `*` | Comma-separated allowed callback domains |\n| `MAX_CONCURRENCY` | `1` | Parallel jobs per GPU |\n| `MAX_IMAGE_SIZE` | `2048` | Maximum dimension (width or height) |\n| `MAX_BATCH_SIZE` | `4` | Maximum batch size |\n| `CACHE_ENABLED` | `true` | Enable result caching |\n| `CACHE_TTL_SECONDS` | `86400` | Cache TTL (24h) |\n| `RATE_LIMIT_MAX` | `100` | Requests per window |\n| `RATE_LIMIT_WINDOW_MS` | `60000` | Rate limit window (1min) |\n| `LOG_LEVEL` | `info` | Pino log level |\n| `PRIVACY_MODE` | `false` | Redact prompts from logs |\n| `CORS_ORIGINS` | `*` | Allowed CORS origins |\n| `NODE_ENV` | `development` | Environment |\n\n## Health & Capabilities\n\n```\nGET \u002Fhealth\n→ { ok: true, version, comfyui: { reachable, url, models? }, uptime }\n\nGET \u002Fcapabilities\n→ { workflows: [...], maxSize, maxBatch, formats, storageProvider }\n```\n\n## Workflows (Crud)\n\n```\nGET    \u002Fworkflows            → list all workflows\nPOST   \u002Fworkflows            → register new workflow\nGET    \u002Fworkflows\u002F:id        → workflow details + input schema\nPUT    \u002Fworkflows\u002F:id        → update workflow\nDELETE \u002Fworkflows\u002F:id        → remove workflow\n```\n\n## Jobs\n\n```\nPOST   \u002Fjobs                 → create job (returns jobId immediately)\nGET    \u002Fjobs\u002F:jobId          → status + progress + outputs\nGET    \u002Fjobs\u002F:jobId\u002Flogs     → sanitized execution logs\nPOST   \u002Fjobs\u002F:jobId\u002Fcancel   → request cancellation\nGET    \u002Fjobs                 → list jobs (filters: status, workflowId, after, before, limit)\n```\n\n## Outputs\n\n```\nGET    \u002Foutputs\u002F:jobId       → list output files + metadata\nGET    \u002Foutputs\u002F:jobId\u002F:file → download\u002Fstream file\n```\n\n## Job Lifecycle\n\n```\nqueued → running → succeeded\n                 → failed\n                 → canceled\n```\n\n1. Client POSTs to `\u002Fjobs` with workflowId + inputs\n2. Gateway validates, checks cache, checks idempotency\n3. If cache hit → returns existing outputs immediately (status: `cache_hit`)\n4. Otherwise → enqueues job, returns `jobId` + `pollUrl`\n5. Worker picks up job, renders workflow template, submits to ComfyUI\n6. Worker polls ComfyUI for progress (or listens via WebSocket)\n7. On completion → downloads outputs, stores them, updates DB\n8. If callbackUrl → sends signed webhook POST\n9. Client polls `\u002Fjobs\u002F:jobId` or receives webhook\n\n## Workflow Templates\n\nWorkflows are ComfyUI JSON with `{{placeholder}}` tokens. The gateway resolves\nthese at runtime using the job's `inputs` and `params`:\n\n```json\n{\n  \"3\": {\n    \"class_type\": \"KSampler\",\n    \"inputs\": {\n      \"seed\": \"{{seed}}\",\n      \"steps\": \"{{steps}}\",\n      \"cfg\": \"{{cfg}}\",\n      \"sampler_name\": \"{{sampler}}\",\n      \"scheduler\": \"normal\",\n      \"denoise\": 1,\n      \"model\": [\"4\", 0],\n      \"positive\": [\"6\", 0],\n      \"negative\": [\"7\", 0],\n      \"latent_image\": [\"5\", 0]\n    }\n  },\n  \"6\": {\n    \"class_type\": \"CLIPTextEncode\",\n    \"inputs\": {\n      \"text\": \"{{prompt}}\",\n      \"clip\": [\"4\", 1]\n    }\n  }\n}\n```\n\nEach workflow has an `inputSchema` (Zod) that validates what the client sends.\n\n## Security Model\n\n- **API Keys**: `X-API-Key` header; keys configured via `API_KEYS` env var as `key1:admin,key2:user`\n- **JWT**: Optional; when `JWT_SECRET` is set, accepts `Authorization: Bearer \u003Ctoken>`\n- **Roles**: `admin` (full CRUD on workflows + jobs), `user` (create jobs, read own jobs)\n- **Rate Limiting**: Per key + per IP, configurable window and max\n- **Webhook Security**: HMAC-SHA256 signature in `X-Signature` header\n- **Callback Allowlist**: Only approved domains receive webhooks\n- **Privacy Mode**: When enabled, prompts are redacted from logs and DB\n- **Idempotency**: `metadata.requestId` prevents duplicate processing\n- **CORS**: Configurable allowed origins\n- **Input Validation**: Zod schemas on every endpoint; max size\u002Fbatch enforced\n\n## Comfyui Integration\n\nThe gateway communicates with ComfyUI via its native HTTP API:\n\n| ComfyUI Endpoint | Gateway Usage |\n|------------------|---------------|\n| `POST \u002Fprompt` | Submit rendered workflow |\n| `GET \u002Fhistory\u002F{id}` | Poll job completion |\n| `GET \u002Fview?filename=...` | Download generated images |\n| `GET \u002Fobject_info` | Discover available nodes\u002Fmodels |\n| `WS \u002Fws?clientId=...` | Real-time progress (optional) |\n\nThe client auto-detects ComfyUI version and adapts:\n- Tries WebSocket first for progress, falls back to polling\n- Handles both `\u002Fhistory` response formats\n- Detects OOM errors and classifies them with recommendations\n\n## Cache Strategy\n\nCache key = SHA-256 of `workflowId + sorted(inputs) + sorted(params) + checkpoint`.\nOn cache hit, the gateway returns a \"virtual\" job with pre-existing outputs — no GPU\ncomputation needed. Cache is stored alongside job data in the DB with configurable TTL.\n\n## Error Classification\n\n| Error Code | Meaning | Retry? |\n|------------|---------|--------|\n| `COMFYUI_UNREACHABLE` | Cannot connect to ComfyUI | Yes (with backoff) |\n| `COMFYUI_OOM` | Out of memory on GPU | No (reduce dimensions) |\n| `COMFYUI_TIMEOUT` | Execution exceeded timeout | Maybe (increase timeout) |\n| `COMFYUI_NODE_ERROR` | Node execution failed | No (check workflow) |\n| `VALIDATION_ERROR` | Invalid inputs | No (fix request) |\n| `WORKFLOW_NOT_FOUND` | Unknown workflowId | No (register workflow) |\n| `RATE_LIMITED` | Too many requests | Yes (wait) |\n| `AUTH_FAILED` | Invalid\u002Fmissing credentials | No (fix auth) |\n| `CACHE_HIT` | (Not an error) Served from cache | N\u002FA |\n\n## Bundled Workflows\n\nThree production-ready workflow templates are included:\n\n## 1. `Sdxl_Realism_V1` — Photorealistic Generation\n\n- Checkpoint: SDXL base\n- Optimized for: Portraits, landscapes, product shots\n- Default: 1024x1024, 30 steps, cfg 7.0\n\n## 2. `Sprite_Transparent_Bg` — Game Sprites With Alpha\n\n- Checkpoint: SD 1.5 or SDXL\n- Optimized for: 2D game assets, transparent backgrounds\n- Default: 512x512, 25 steps, cfg 7.5\n\n## 3. `Icon_512` — App Icons With Optional Upscale\n\n- Checkpoint: SDXL base\n- Optimized for: Square icons, clean edges\n- Default: 512x512, 20 steps, cfg 6.0, optional 2x upscale\n\n## Observability\n\n- **Structured Logs**: Pino JSON logs with `correlationId` on every request\n- **Metrics**: Jobs queued\u002Frunning\u002Fsucceeded\u002Ffailed, avg processing time, cache hit rate\n- **Audit Log**: Admin actions (workflow CRUD, key management) logged with timestamp + actor\n\n## Cli Reference\n\n```bash\nnpx tsx src\u002Fcli\u002Findex.ts init                    # Create dirs, .env.example\nnpx tsx src\u002Fcli\u002Findex.ts add-workflow \u003Cfile>      # Register workflow template\n  --id \u003Cid> --name \u003Cname> --schema \u003Cschema.json>\nnpx tsx src\u002Fcli\u002Findex.ts list-workflows           # Show registered workflows\nnpx tsx src\u002Fcli\u002Findex.ts run                      # Start API server\nnpx tsx src\u002Fcli\u002Findex.ts worker                   # Start job worker\nnpx tsx src\u002Fcli\u002Findex.ts health                   # Check ComfyUI connectivity\n```\n\n## Troubleshooting\n\nRead `references\u002Ftroubleshooting.md` for detailed guidance on:\n- ComfyUI not reachable (firewall, wrong port, Docker networking)\n- OOM errors (reduce resolution, batch, or steps)\n- Slow generation (GPU utilization, queue depth, model loading)\n- Webhook failures (DNS, SSL, timeout, domain allowlist)\n- Redis connection issues (fallback to in-memory)\n- Storage permission errors (local path, S3 credentials)\n\n## Integration Examples\n\nRead `references\u002Fintegration.md` for ready-to-use examples with:\n- curl commands for every endpoint\n- n8n webhook workflow\n- Supabase Edge Function caller\n- Claude Code \u002F Claude.ai integration\n- Python requests client\n- JavaScript fetch client\n\n## File Structure\n\n```\ncomfyui-gateway\u002F\n├── SKILL.md\n├── package.json\n├── tsconfig.json\n├── .env.example\n├── src\u002F\n│   ├── api\u002F\n│   │   ├── server.ts          # Fastify setup + plugins\n│   │   ├── routes\u002F\n│   │   │   ├── health.ts      # GET \u002Fhealth, \u002Fcapabilities\n│   │   │   ├── workflows.ts   # CRUD \u002Fworkflows\n│   │   │   ├── jobs.ts        # CRUD \u002Fjobs\n│   │   │   └── outputs.ts     # GET \u002Foutputs\n│   │   ├── middleware\u002F\n│   │   │   └── error-handler.ts\n│   │   └── plugins\u002F\n│   │       ├── auth.ts        # API key + JWT\n│   │       ├── rate-limit.ts\n│   │       └── cors.ts\n│   ├── worker\u002F\n│   │   └── processor.ts       # Job processor\n│   ├── comfyui\u002F\n│   │   └── client.ts          # ComfyUI HTTP + WS client\n│   ├── storage\u002F\n│   │   ├── index.ts           # Provider factory\n│   │   ├── local.ts           # Local filesystem\n│   │   └── s3.ts              # S3-compatible\n│   ├── workflows\u002F\n│   │   └── manager.ts         # Template CRUD + rendering\n│   ├── cache\u002F\n│   │   └── index.ts           # Hash-based cache\n│   ├── notifications\u002F\n│   │   └── webhook.ts         # HMAC-signed callbacks\n│   ├── auth\u002F\n│   │   └── index.ts           # Key\u002FJWT validation + roles\n│   ├── db\u002F\n│   │   ├── index.ts           # DB factory (SQLite\u002FPostgres)\n│   │   └── migrations.ts      # Schema creation\n│   ├── cli\u002F\n│   │   └── index.ts           # CLI commands\n│   ├── utils\u002F\n│   │   ├── config.ts          # Env loading + validation\n│   │   ├── errors.ts          # Error classes\n│   │   ├── logger.ts          # Pino setup\n│   │   └── hash.ts            # SHA-256 hashing\n│   └── index.ts               # Main entrypoint\n├── config\u002F\n│   └── workflows\u002F             # Bundled workflow templates\n│       ├── sdxl_realism_v1.json\n│       ├── sdxl_realism_v1.schema.json\n│       ├── sprite_transparent_bg.json\n│       ├── sprite_transparent_bg.schema.json\n│       ├── icon_512.json\n│       └── icon_512.schema.json\n├── data\u002F\n│   ├── outputs\u002F               # Generated images\n│   ├── workflows\u002F             # User-added wor\n\n## Best Practices\n\n- Provide clear, specific context about your project and requirements\n- Review all suggestions before applying them to production code\n- Combine with other complementary skills for comprehensive analysis\n\n## Common Pitfalls\n\n- Using this skill for tasks outside its domain expertise\n- Applying recommendations without understanding your specific context\n- Not providing enough project context for accurate analysis\n\n## Related Skills\n\n- `ai-studio-image` - Complementary skill for enhanced analysis\n- `image-studio` - Complementary skill for enhanced analysis\n- `stability-ai` - Complementary skill for enhanced analysis\n",{"name":5,"risk":37,"tags":44,"tools":45,"author":51,"source":26,"date_added":52,"description":7},[21,22,27,36],[46,47,48,49,50],"claude-code","antigravity","cursor","gemini-cli","codex-cli","renat","2026-03-06","main","c173cdffe08e788a99b91928a831b476b8434838","ecosystem\u002Fskills\u002Fcomfyui_gateway",0,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw","https:\u002F\u002Fportfolio-longleo.vercel.app\u002Flabs\u002Fomniclaw.html","https:\u002F\u002Fgithub.com\u002FLongLeo287","https:\u002F\u002Fwww.facebook.com\u002FResourceRookie2023","2026-11-14 08:48:28",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add LongLeo287\u002FOmniClaw --skill comfyui_gateway",{"tool":68,"command":69},"bunx","bunx skills add LongLeo287\u002FOmniClaw --skill comfyui_gateway",{"tool":71,"command":72},"pnpm","pnpm dlx skills add LongLeo287\u002FOmniClaw --skill comfyui_gateway","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002FSKILL.md",true,[76,82,86,90,94],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"_DIR_IDENTITY.md","REFERENCE","参考文档",152,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002F_DIR_IDENTITY.md",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"README.md",465,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002FREADME.md",{"path":87,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fintegration.md",48284,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002Freferences\u002Fintegration.md",{"path":91,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Ftroubleshooting.md",29528,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002Freferences\u002Ftroubleshooting.md",{"path":95,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":96,"sourceHtmlUrl":97},"schema.json",447,"https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fcomfyui_gateway\u002Fschema.json",[99,126,147,171,186,209],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":39},"01M6JR0KQP4MHT32TN40D9CBFX","UI-UX Pro Max","Advanced UI\u002FUX analysis and generation skills with data-driven patterns. Python scripts (core.py, search.py) for systematic UI pattern extraction, design system generation, and component search from curated data sources.","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fui_components\u002Fui_ux_pro_max\u002FSKILL.md",[],[106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],"ux","ui","ui ux pro max","max","pro","ui ux","design","component","search","analysis","team","rd","ui-ux","active","systematic","scripts","pattern extraction","sources","advanced","data-driven",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":39},"01M6JR0EF5AEQHP2FSTB57H05P","shadcn-ui","Expert guidance for integrating and building applications with shadcn\u002Fui components, including component discovery, installation, customization, and best practices.","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fui_components\u002Fshadcn_ui\u002FSKILL.md",[],[133,107,134,135,113,136,137,138,139,116,140,141,142,119,143,144,145,146],"shadcn","shadcn ui","components","core","best practices","applications","discovery","customization","guidance","expert","installation","ui components","with","for",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":39},"01M6JR08F51BEN17RHFYX65WVE","zustand_store_ts","Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state\u002Faction separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fzustand_store_ts\u002FSKILL.md",[],[154,155,156,36,157,158,159,160,161,162,163,164,165,166,167,168,145,169,170],"zustand store ts","zustand","store","microsoft","react","create","state management","state","react state management","management","global","use","patterns","separation","middleware","action","implementing",{"skillNo":172,"name":155,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":39},"01M6JR00TDMVAFFCZXZ04AN7Q7","Zustand state management guide. Use when working with store code (src\u002Fstore\u002F**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fzustand\u002FSKILL.md",[],[155,177,160,33,161,178,179,163,180,165,181,182,183,156,145,184,185,169,170],"development","actions","src","guide","implementation","zustand state","triggers","questions","zustand state management",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":192,"publishedAt":39},"01M6JQZSWV4KWJP112G6XHEP44","youtube_summarizer","Automatically fetch YouTube video transcripts, generate structured summaries, and send full transcripts to messaging platforms. Detects YouTube URLs and provides metadata, key insights, and downloadable transcripts.","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fyoutube_summarizer\u002FSKILL.md",[],[193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208],"youtube","youtube summarizer","summarizer","generate","metadata","messaging","Video","fetch","telegram","transcription","summarization","structured","full","insights","transcripts","summaries",{"skillNo":210,"name":211,"nameZh":6,"description":212,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":213,"categories":214,"keywords":215,"publishedAt":39},"01M6JQZN3QJB6B77JGKJD62DQT","youtube_clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002FLongLeo287\u002FOmniClaw\u002Fblob\u002Fmain\u002Fecosystem\u002Fskills\u002Fyoutube_clipper\u002FSKILL.md",[],[193,216,217,199,218,219,220,221,222,223,224,225,226,227,228,229,230],"clipper","youtube clipper","Bash","下载","视频","生成","关键词","翻译","read","write","clip","总结","工具","文案","sonnet"]