{"id":23464538,"url":"https://github.com/comfy-addons/comfyui-sdk","last_synced_at":"2025-04-06T00:06:51.593Z","repository":{"id":248814659,"uuid":"829839477","full_name":"comfy-addons/comfyui-sdk","owner":"comfy-addons","description":"SDK for ComfyUI","archived":false,"fork":false,"pushed_at":"2025-02-28T05:01:08.000Z","size":345,"stargazers_count":126,"open_issues_count":3,"forks_count":16,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T23:11:49.132Z","etag":null,"topics":["comfyui","comfyui-manager","comfyui-workflow","sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/comfy-addons.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-17T05:23:58.000Z","updated_at":"2025-03-28T20:52:01.000Z","dependencies_parsed_at":"2024-09-15T08:56:43.592Z","dependency_job_id":"defeae0b-c97e-42b6-bca5-3f6090a47324","html_url":"https://github.com/comfy-addons/comfyui-sdk","commit_stats":null,"previous_names":["tctien342/comfyui-sdk","comfy-addons/comfyui-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comfy-addons%2Fcomfyui-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comfy-addons%2Fcomfyui-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comfy-addons%2Fcomfyui-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comfy-addons%2Fcomfyui-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/comfy-addons","download_url":"https://codeload.github.com/comfy-addons/comfyui-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415967,"owners_count":20935388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comfyui","comfyui-manager","comfyui-workflow","sdk"],"created_at":"2024-12-24T10:18:21.494Z","updated_at":"2025-04-06T00:06:51.572Z","avatar_url":"https://github.com/comfy-addons.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/tctien342"],"categories":[],"sub_categories":[],"readme":"# ✨ ComfyUI SDK ✨\n\n[![NPM Version](https://img.shields.io/npm/v/@saintno/comfyui-sdk?style=flat-square)](https://www.npmjs.com/package/@saintno/comfyui-sdk)\n[![License](https://img.shields.io/npm/l/@saintno/comfyui-sdk?style=flat-square)](https://github.com/tctien342/comfyui-sdk/blob/main/LICENSE)\n![CI](https://github.com/tctien342/comfyui-sdk/actions/workflows/release.yml/badge.svg)\n[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-donate-yellow.svg)](https://www.buymeacoffee.com/tctien342)\n\nA robust and meticulously crafted TypeScript SDK 🚀 for seamless interaction with the [ComfyUI](https://github.com/comfyanonymous/ComfyUI) API. This SDK significantly simplifies the complexities of building, executing, and managing ComfyUI workflows, all while providing real-time updates and supporting multiple instances. 🖼️\n\n## 🧭 Table of Contents\n\n- [🌟 Key Features 🌟](#-key-features-)\n- [📦 Installation 📦](#-installation-)\n- [🚀 Getting Started 🚀](#-getting-started-)\n  - [🎬 Basic Usage](#-basic-usage)\n  - [🔄 Managing Multiple Instances with `ComfyPool`](#-managing-multiple-instances-with-comfypool)\n  - [🔑 Authentication](#-authentication)\n- [📚 API Reference 📚](#-api-reference-)\n  - [`ComfyApi`](#comfyapi)\n  - [`CallWrapper`](#callwrapper)\n  - [`PromptBuilder`](#promptbuilder)\n  - [`ComfyPool`](#comfypool)\n  - [🗂️ Enums](#-enums)\n  - [🗄️ Types](#-types)\n  - [🧩 Features](#-features)\n- [📂 Examples](#-examples)\n- [🤝 Contributing](#-contributing)\n- [📜 License](#-license)\n\n## 🌟 Key Features 🌟\n\n- **💎 TypeScript Powered**: Enjoy a fully typed codebase, ensuring enhanced development, maintainability, and type safety. 🛡️\n- **🏗️ Workflow Builder**: Construct and manipulate intricate ComfyUI workflows effortlessly using a fluent, intuitive builder pattern. 🧩\n- **🤹 Multi-Instance Management**: Handle a pool of ComfyUI instances with ease, employing flexible queueing strategies for optimal resource utilization. 🌐\n- **⚡ Real-Time Updates**: Subscribe to WebSocket events for live progress tracking, image previews, and error notifications. 🔔\n- **🔑 Authentication Flexibility**: Supports Basic Auth, Bearer Token, and Custom Authentication Headers, catering to diverse security requirements. 🔒\n- **🔌 Extension Support**: Seamlessly integrate with ComfyUI Manager and leverage system monitoring through the ComfyUI-Crystools extension. 🛠️\n- **🔀 Flexible Node Bypassing**: Strategically bypass specific nodes in your workflows during generation, enabling advanced customization. ⏭️\n- **📚 Comprehensive Examples**: Includes practical examples for Text-to-Image (T2I), Image-to-Image (I2I), and complex multi-node workflows. 📝\n- **🚨 Robust Error Handling**: Provides detailed error messages to facilitate debugging and graceful handling of API failures. 🐛\n- **📝 Automatic Changelog**: Automatically generates a changelog with each release, utilizing `auto-changelog` for transparent version tracking. 🔄\n\n## 📦 Installation 📦\n\n```bash\nbun add @saintno/comfyui-sdk\n```\n\nor\n\n```bash\nnpm i @saintno/comfyui-sdk\n```\n\n## 🚀 Getting Started 🚀\n\n### 🎬 Basic Usage\n\nHere's a simplified example to quickly get you started:\n\n```typescript\nimport { ComfyApi, CallWrapper, PromptBuilder, TSamplerName, TSchedulerName, seed } from \"@saintno/comfyui-sdk\";\nimport ExampleTxt2ImgWorkflow from \"./example-txt2img-workflow.json\";\n\nconst api = new ComfyApi(\"http://localhost:8189\").init();\nconst workflow = new PromptBuilder(\n  ExampleTxt2ImgWorkflow,\n  [\"positive\", \"negative\", \"checkpoint\", \"seed\", \"batch\", \"step\", \"cfg\", \"sampler\", \"sheduler\", \"width\", \"height\"],\n  [\"images\"]\n)\n  .setInputNode(\"checkpoint\", \"4.inputs.ckpt_name\")\n  .setInputNode(\"seed\", \"3.inputs.seed\")\n  .setInputNode(\"batch\", \"5.inputs.batch_size\")\n  .setInputNode(\"negative\", \"7.inputs.text\")\n  .setInputNode(\"positive\", \"6.inputs.text\")\n  .setInputNode(\"cfg\", \"3.inputs.cfg\")\n  .setInputNode(\"sampler\", \"3.inputs.sampler_name\")\n  .setInputNode(\"sheduler\", \"3.inputs.scheduler\")\n  .setInputNode(\"step\", \"3.inputs.steps\")\n  .setInputNode(\"width\", \"5.inputs.width\")\n  .setInputNode(\"height\", \"5.inputs.height\")\n  .setOutputNode(\"images\", \"9\")\n  .input(\"checkpoint\", \"SDXL/realvisxlV40_v40LightningBakedvae.safetensors\", api.osType)\n  .input(\"seed\", seed())\n  .input(\"step\", 6)\n  .input(\"cfg\", 1)\n  .input\u003cTSamplerName\u003e(\"sampler\", \"dpmpp_2m_sde_gpu\")\n  .input\u003cTSchedulerName\u003e(\"sheduler\", \"sgm_uniform\")\n  .input(\"width\", 1024)\n  .input(\"height\", 1024)\n  .input(\"batch\", 1)\n  .input(\"positive\", \"A picture of cute dog on the street\");\n\nnew CallWrapper(api, workflow)\n  .onFinished((data) =\u003e console.log(data.images?.images.map((img: any) =\u003e api.getPathImage(img))))\n  .run();\n```\n\n#### 🔍 Breakdown\n\n- Import essential components from the SDK.\n- Create and initialize the `ComfyApi` instance.\n- Use `PromptBuilder` to define the workflow structure and set input nodes.\n- Set specific input values, including the checkpoint path, seed, and prompt.\n- Execute the workflow and log the generated image URLs using the `CallWrapper`.\n\n### 🔄 Managing Multiple Instances with `ComfyPool`\n\n```typescript\nimport {\n  ComfyApi,\n  CallWrapper,\n  ComfyPool,\n  EQueueMode,\n  PromptBuilder,\n  seed,\n  TSamplerName,\n  TSchedulerName\n} from \"@saintno/comfyui-sdk\";\nimport ExampleTxt2ImgWorkflow from \"./example-txt2img-workflow.json\";\n\nconst ApiPool = new ComfyPool(\n  [new ComfyApi(\"http://localhost:8188\"), new ComfyApi(\"http://localhost:8189\")],\n  EQueueMode.PICK_ZERO\n)\n  .on(\"init\", () =\u003e console.log(\"Pool in initializing\"))\n  .on(\"add_job\", (ev) =\u003e console.log(\"Job added at index\", ev.detail.jobIdx, \"weight:\", ev.detail.weight))\n  .on(\"added\", (ev) =\u003e console.log(\"Client added\", ev.detail.clientIdx));\n\nconst generateFn = async (api: ComfyApi, clientIdx?: number) =\u003e {\n  const workflow = new PromptBuilder(\n    ExampleTxt2ImgWorkflow,\n    [\"positive\", \"negative\", \"checkpoint\", \"seed\", \"batch\", \"step\", \"cfg\", \"sampler\", \"sheduler\", \"width\", \"height\"],\n    [\"images\"]\n  )\n    .setInputNode(\"checkpoint\", \"4.inputs.ckpt_name\")\n    .setInputNode(\"seed\", \"3.inputs.seed\")\n    .setInputNode(\"batch\", \"5.inputs.batch_size\")\n    .setInputNode(\"negative\", \"7.inputs.text\")\n    .setInputNode(\"positive\", \"6.inputs.text\")\n    .setInputNode(\"step\", \"3.inputs.steps\")\n    .setInputNode(\"width\", \"5.inputs.width\")\n    .setInputNode(\"height\", \"5.inputs.height\")\n    .setInputNode(\"cfg\", \"3.inputs.cfg\")\n    .setInputNode(\"sampler\", \"3.inputs.sampler_name\")\n    .setInputNode(\"scheduler\", \"3.inputs.scheduler\")\n    .setOutputNode(\"images\", \"9\")\n    .input(\"checkpoint\", \"SDXL/realvisxlV40_v40LightningBakedvae.safetensors\", api.osType)\n    .input(\"seed\", seed())\n    .input(\"step\", 6)\n    .input(\"width\", 512)\n    .input(\"height\", 512)\n    .input(\"batch\", 2)\n    .input(\"cfg\", 1)\n    .input\u003cTSamplerName\u003e(\"sampler\", \"dpmpp_2m_sde_gpu\")\n    .input\u003cTSchedulerName\u003e(\"scheduler\", \"sgm_uniform\")\n    .input(\"positive\", \"A close up picture of cute Cat\")\n    .input(\"negative\", \"text, blurry, bad picture, nsfw\");\n\n  return new Promise\u003cstring[]\u003e((resolve) =\u003e {\n    new CallWrapper(api, workflow)\n      .onFinished((data) =\u003e {\n        const url = data.images?.images.map((img: any) =\u003e api.getPathImage(img));\n        resolve(url as string[]);\n      })\n      .run();\n  });\n};\n\nconst jobA = ApiPool.batch(Array(5).fill(generateFn), 10).then((res) =\u003e {\n  console.log(\"Batch A done\");\n  return res.flat();\n});\n\nconst jobB = ApiPool.batch(Array(5).fill(generateFn), 0).then((res) =\u003e {\n  console.log(\"Batch B done\");\n  return res.flat();\n});\n\nconsole.log(await Promise.all([jobA, jobB]).then((res) =\u003e res.flat()));\n```\n\n#### 🔍 Breakdown\n\n- Create a `ComfyPool` with multiple `ComfyApi` instances.\n- Set up event listeners for pool initialization, job additions, and client connections.\n- Define an async function (`generateFn`) that creates a workflow, sets its inputs, and executes it with a `CallWrapper`.\n- Use `ApiPool.batch` to run multiple jobs and wait for all batches to complete.\n\n### 🔑 Authentication\n\n```typescript\nimport { ComfyApi, BasicCredentials, BearerTokenCredentials, CustomCredentials } from \"@saintno/comfyui-sdk\";\n\n// Basic Authentication\nconst basicAuth = new ComfyApi(\"http://localhost:8189\", \"node-id\", {\n  credentials: { type: \"basic\", username: \"username\", password: \"password\" } as BasicCredentials\n}).init();\n\n// Bearer Token Authentication\nconst bearerAuth = new ComfyApi(\"http://localhost:8189\", \"node-id\", {\n  credentials: { type: \"bearer_token\", token: \"your_bearer_token\" } as BearerTokenCredentials\n}).init();\n\n// Custom Header Authentication\nconst customAuth = new ComfyApi(\"http://localhost:8189\", \"node-id\", {\n  credentials: { type: \"custom\", headers: { \"X-Custom-Header\": \"your_custom_header\" } } as CustomCredentials\n}).init();\n```\n\n#### 🔍 Breakdown\n\n- Import the necessary types from the SDK.\n- Create `ComfyApi` instances using the corresponding credential types: `BasicCredentials`, `BearerTokenCredentials`, and `CustomCredentials`..\n\n## 📚 API Reference 📚\n\n### `ComfyApi`\n\n#### 🏗️ Constructor\n\n```typescript\nconstructor(host: string, clientId: string, opts?: { forceWs?: boolean, wsTimeout?: number, credentials?: BasicCredentials | BearerTokenCredentials | CustomCredentials; })\n```\n\n- `host`: The base URL of your ComfyUI server.\n- `clientId`: A unique ID for WebSocket communication (optional). Defaults to a generated ID.\n- `opts`: Optional settings:\n  - `forceWs`: Boolean to force WebSocket usage.\n  - `wsTimeout`: Timeout for WebSocket connections (milliseconds).\n  - `credentials`: Optional authentication credentials.\n\n#### ⚙️ Methods\n\n- `init(maxTries?: number, delayTime?: number)`: Initializes the client and establishes connection.\n- `on\u003cK extends keyof TComfyAPIEventMap\u003e(type: K, callback: (event: TComfyAPIEventMap[K]) =\u003e void, options?: AddEventListenerOptions | boolean)`: Attach an event listener.\n- `off\u003cK extends keyof TComfyAPIEventMap\u003e(type: K, callback: (event: TComfyAPIEventMap[K]) =\u003e void, options?: EventListenerOptions | boolean)`: Detach an event listener.\n- `removeAllListeners()`: Detach all event listeners.\n- `fetchApi(route: string, options?: FetchOptions)`: Fetch data from the API endpoint.\n- `pollStatus(timeout?: number)`: Polls the ComfyUI server status.\n- `queuePrompt(number: number | null, workflow: object)`: Queues a prompt for processing.\n- `appendPrompt(workflow: object)`: Adds a prompt to the workflow queue.\n- `getQueue()`: Retrieves the current state of the queue.\n- `getHistories(maxItems?: number)`: Retrieves the prompt execution history.\n- `getHistory(promptId: string)`: Retrieves a specific history entry by ID.\n- `getSystemStats()`: Retrieves system and device statistics.\n- `getExtensions()`: Retrieves a list of installed extensions.\n- `getEmbeddings()`: Retrieves a list of available embeddings.\n- `getCheckpoints()`: Retrieves a list of available checkpoints.\n- `getLoras()`: Retrieves a list of available Loras.\n- `getSamplerInfo()`: Retrieves sampler and scheduler information.\n- `getNodeDefs(nodeName?: string)`: Retrieves node object definitions.\n- `getUserConfig()`: Get user configuration data.\n- `createUser(username: string)`: Create new user.\n- `getSettings()`: Get all setting values for the current user.\n- `getSetting(id: string)`: Get a specific setting for the current user.\n- `storeSettings(settings: Record\u003cstring, unknown\u003e)`: Store setting for the current user.\n- `storeSetting(id: string, value: unknown)`: Store a specific setting for the current user.\n- `uploadImage(file: Buffer | Blob, fileName: string, config?: { override?: boolean; subfolder?: string })`: Uploads an image file.\n- `uploadMask(file: Buffer | Blob, originalRef: ImageInfo)`: Uploads a mask file.\n- `freeMemory(unloadModels: boolean, freeMemory: boolean)`: Frees memory by unloading models.\n- `getPathImage(imageInfo: ImageInfo)`: Returns the path to an image.\n- `getImage(imageInfo: ImageInfo)`: Returns the blob data of image.\n- `getUserData(file: string)`: Get a user data file.\n- `storeUserData(file: string, data: unknown, options?: RequestInit \u0026 { overwrite?: boolean, stringify?: boolean, throwOnError?: boolean })`: Store a user data file.\n- `deleteUserData(file: string)`: Delete a user data file.\n- `moveUserData(source: string, dest: string, options?: RequestInit \u0026 { overwrite?: boolean })`: Move a user data file.\n- `listUserData(dir: string, recurse?: boolean, split?: boolean)`: List a user data file.\n- `interrupt()`: Interrupts the execution of the running prompt.\n- `reconnectWs(opened?: boolean)`: Reconnects to the WebSocket server.\n\n### `CallWrapper`\n\n#### 🏗️ Constructor\n\n```typescript\nconstructor(client: ComfyApi, workflow: PromptBuilder\u003cI, O, T\u003e)\n```\n\n- `client`: An instance of the `ComfyApi` client.\n- `workflow`: An instance of `PromptBuilder` defining the workflow.\n\n#### ⚙️ Methods\n\n- `onPreview(fn: (ev: Blob, promptId?: string) =\u003e void)`: Set callback for preview events.\n- `onPending(fn: (promptId?: string) =\u003e void)`: Set callback when job is queued.\n- `onStart(fn: (promptId?: string) =\u003e void)`: Set callback when the job is started.\n- `onOutput(fn: (key: keyof PromptBuilder\u003cI, O, T\u003e[\"mapOutputKeys\"], data: any, promptId?: string) =\u003e void)`: Sets a callback for when an output node is executed.\n- `onFinished(fn: (data: Record\u003ckeyof PromptBuilder\u003cI, O, T\u003e[\"mapOutputKeys\"], any\u003e, promptId?: string) =\u003e void)`: Set callback when the job is finished.\n- `onFailed(fn: (err: Error, promptId?: string) =\u003e void)`: Set callback when the job failed.\n- `onProgress(fn: (info: NodeProgress, promptId?: string) =\u003e void)`: Set callback for progress updates.\n- `run()`: Executes the workflow.\n\n### `PromptBuilder`\n\n#### 🏗️ Constructor\n\n```typescript\nconstructor(prompt: T, inputKeys: I[], outputKeys: O[])\n```\n\n- `prompt`: The initial workflow data object.\n- `inputKeys`: An array of input node keys.\n- `outputKeys`: An array of output node keys.\n\n#### ⚙️ Methods\n\n- `clone()`: Creates a new `PromptBuilder` instance with the same configuration.\n- `bypass(node: keyof T | (keyof T)[]): PromptBuilder\u003cI, O, T\u003e`: Marks node(s) to be bypassed at generation.\n- `reinstate(node: keyof T | (keyof T)[]): PromptBuilder\u003cI, O, T\u003e`: Unmarks node(s) from bypass at generation.\n- `setInputNode(input: I, key: DeepKeys\u003cT\u003e | Array\u003cDeepKeys\u003cT\u003e\u003e)`: Sets input node path for a key.\n- `setRawInputNode(input: I, key: string | string[])`: Sets raw input node path for a key.\n- `appendInputNode(input: I, key: DeepKeys\u003cT\u003e | Array\u003cDeepKeys\u003cT\u003e\u003e)`: Appends a node to the input node path.\n- `appendRawInputNode(input: I, key: string | string[])`: Appends a node to the raw input node path.\n- `setOutputNode(output: O, key: DeepKeys\u003cT\u003e)`: Sets output node path for a key.\n- `setRawOutputNode(output: O, key: string)`: Sets raw output node path for a key.\n- `input\u003cV = string | number | undefined\u003e(key: I, value: V, encodeOs?: OSType)`: Sets an input value.\n- `inputRaw\u003cV = string | number | undefined\u003e(key: string, value: V, encodeOs?: OSType)`: Sets a raw input value with dynamic key.\n- `get workflow`: Retrieves the workflow object.\n- `get caller`: Retrieves current `PromptBuilder` object.\n\n### `ComfyPool`\n\n#### 🏗️ Constructor\n\n```typescript\nconstructor(clients: ComfyApi[], mode: EQueueMode = EQueueMode.PICK_ZERO)\n```\n\n- `clients`: Array of `ComfyApi` instances.\n- `mode`: The queue mode using `EQueueMode` enum values.\n\n#### ⚙️ Methods\n\n- `on\u003cK extends keyof TComfyPoolEventMap\u003e(type: K, callback: (event: TComfyPoolEventMap[K]) =\u003e void, options?: AddEventListenerOptions | boolean)`: Attach an event listener.\n- `off\u003cK extends keyof TComfyPoolEventMap\u003e(type: K, callback: (event: TComfyPoolEventMap[K]) =\u003e void, options?: EventListenerOptions | boolean)`: Detach an event listener.\n- `addClient(client: ComfyApi)`: Adds a new client to the pool.\n- `removeClient(client: ComfyApi)`: Removes a client from the pool.\n- `removeClientByIndex(index: number)`: Removes a client by index.\n- `changeMode(mode: EQueueMode)`: Changes the queue mode.\n- `pick(idx?: number)`: Picks a client by index.\n- `pickById(id: string)`: Picks a client by ID.\n- `run\u003cT\u003e(job: (client: ComfyApi, clientIdx?: number) =\u003e Promise\u003cT\u003e, weight?: number, clientFilter?: { includeIds?: string[]; excludeIds?: string[] })`: Run a job with priority on an available client.\n- `batch\u003cT\u003e(jobs: Array\u003c(client: ComfyApi, clientIdx?: number) =\u003e Promise\u003cT\u003e\u003e, weight?: number, clientFilter?: { includeIds?: string[]; excludeIds?: string[] })`: Run multiple jobs concurrently.\n\n### 🗂️ Enums\n\n- `EQueueMode`:\n  - `PICK_ZERO`: Selects the client with zero remaining queue.\n  - `PICK_LOWEST`: Selects the client with the lowest remaining queue.\n  - `PICK_ROUTINE`: Selects clients in a round-robin manner.\n\n### 🗄️ Types\n\n- `OSType`:\n  - `POSIX`: For Unix-like systems.\n  - `NT`: For Windows systems.\n  - `JAVA`: For Java virtual machine.\n- `TSamplerName`: A union type of all available sampler names.\n- `TSchedulerName`: A union type of all available scheduler names.\n\n### 🧩 Features\n\n- `ManagerFeature`: Provides methods to manage ComfyUI Manager Extension.\n\n  ```typescript\n  const api = new ComfyApi(\"http://localhost:8189\").init();\n  await api.waitForReady();\n\n  if (api.ext.manager.isSupported) {\n    await api.ext.manager.getExtensionList().then(console.log);\n    // Check api.ext.manager for more methods\n  }\n  ```\n\n- `MonitoringFeature`: Provides methods to monitor system resources using ComfyUI-Crystools Extension.\n\n  ```typescript\n  const api = new ComfyApi(\"http://localhost:8189\").init();\n  await api.waitForReady();\n\n  if (api.ext.monitor.isSupported) {\n    // For subscribing to system monitor events\n    api.ext.monitor.on(\"system_monitor\", (ev) =\u003e {\n      console.log(ev.detail);\n    });\n\n    // For getting current monitor data\n    console.log(api.ext.monitor.monitorData);\n  }\n  ```\n\n\u003e Note: Features require respective extensions ([ComfyUI-Manager](https://github.com/ltdrdata/ComfyUI-Manager) and [ComfyUI-Crystools](https://github.com/crystian/ComfyUI-Crystools)) to be installed.\n\n## 📂 Examples\n\nThe `examples` directory contains practical demonstrations of SDK usage:\n\n- `example-i2i.ts`: Demonstrates image-to-image generation.\n- `example-pool.ts`: Demonstrates how to manage multiple ComfyUI instances using `ComfyPool`.\n- `example-pool-basic-auth.ts`: Demonstrates how to use `ComfyPool` with HTTP Basic Authentication.\n- `example-t2i.ts`: Demonstrates text-to-image generation.\n- `example-t2i-upscaled.ts`: Demonstrates text-to-image generation with upscaling.\n- `example-img2img-workflow.json`: Example workflow for image-to-image.\n- `example-txt2img-workflow.json`: Example workflow for text-to-image.\n- `example-txt2img-upscaled-workflow.json`: Example workflow for text-to-image with upscaling.\n\n## 🤝 Contributing\n\nContributions are always welcome! Feel free to submit pull requests or create issues for bug reports and feature enhancements. 🙏\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for more details. 📄\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomfy-addons%2Fcomfyui-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomfy-addons%2Fcomfyui-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomfy-addons%2Fcomfyui-sdk/lists"}