{"id":21721739,"url":"https://github.com/itskaynine/comfy-ui-client","last_synced_at":"2025-04-30T18:29:14.759Z","repository":{"id":184531250,"uuid":"672031865","full_name":"itsKaynine/comfy-ui-client","owner":"itsKaynine","description":"Node.js WebSockets API client for ComfyUI","archived":false,"fork":false,"pushed_at":"2024-03-22T12:08:02.000Z","size":72,"stargazers_count":95,"open_issues_count":3,"forks_count":33,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T18:38:50.070Z","etag":null,"topics":["api","comfyui","nodejs","sdxl","stable-diffusion"],"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/itsKaynine.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-07-28T18:30:18.000Z","updated_at":"2025-04-16T07:39:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4e20747-2e8a-45c3-aeaa-217fb1d58ac1","html_url":"https://github.com/itsKaynine/comfy-ui-client","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"735d6aa3bf9f4971d07092de7c5d60a45160c672"},"previous_names":["itskaynine/comfy-ui-client"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsKaynine%2Fcomfy-ui-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsKaynine%2Fcomfy-ui-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsKaynine%2Fcomfy-ui-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsKaynine%2Fcomfy-ui-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsKaynine","download_url":"https://codeload.github.com/itsKaynine/comfy-ui-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251760181,"owners_count":21639357,"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":["api","comfyui","nodejs","sdxl","stable-diffusion"],"created_at":"2024-11-26T02:18:48.706Z","updated_at":"2025-04-30T18:29:14.711Z","avatar_url":"https://github.com/itsKaynine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ComfyUI Client\n\n[![npm][badge-version]][npm]\n[![license][badge-license]][license]\n\nNode.js [ComfyUI](https://github.com/comfyanonymous/ComfyUI) client based on the [WebSockets API example](https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/websockets_api_example.py).\n\nSee example in [`examples/generate`][examples-generate].\n\n## Install\n\nTo install `comfy-ui-client` in an existing project:\n\n```sh\nnpm install comfy-ui-client\n```\n\n## Example Usage\n\n```ts\nimport { ComfyUIClient } from 'comfy-ui-client';\nimport type { Prompt } from 'comfy-ui-client';\n\n// Your prompt / workflow\nconst prompt: Prompt = {\n    '3': {\n        class_type: 'KSampler',\n        inputs: {\n            cfg: 8,\n            denoise: 1,\n            latent_image: ['5', 0],\n            model: ['4', 0],\n            negative: ['7', 0],\n            positive: ['6', 0],\n            sampler_name: 'euler',\n            scheduler: 'normal',\n            seed: 8566257,\n            steps: 20,\n        },\n    },\n    '4': {\n        class_type: 'CheckpointLoaderSimple',\n        inputs: {\n            ckpt_name: 'v1-5-pruned-emaonly.cpkt',\n        },\n    },\n    '5': {\n        class_type: 'EmptyLatentImage',\n        inputs: {\n            batch_size: 1,\n            height: 512,\n            width: 512,\n        },\n    },\n    '6': {\n        class_type: 'CLIPTextEncode',\n        inputs: {\n            clip: ['4', 1],\n            text: 'masterpiece best quality girl',\n        },\n    },\n    '7': {\n        class_type: 'CLIPTextEncode',\n        inputs: {\n            clip: ['4', 1],\n            text: 'bad hands',\n        },\n    },\n    '8': {\n        class_type: 'VAEDecode',\n        inputs: {\n            samples: ['3', 0],\n            vae: ['4', 2],\n        },\n    },\n    '9': {\n        class_type: 'SaveImage',\n        inputs: {\n            filename_prefix: 'ComfyUI',\n            images: ['8', 0],\n        },\n    },\n};\n\n// Set the text prompt for our positive CLIPTextEncode\nprompt['6'].inputs.text = 'masterpiece best quality man';\n\n// Set the seed for our KSampler node\nprompt['3'].inputs.seed = 5;\n\n// Create client\nconst serverAddress = '127.0.0.1:8188';\nconst clientId = 'baadbabe-b00b-4206-9420-deadd00d1337';\nconst client = new ComfyUIClient(serverAddress, clientId);\n\n// Connect to server\nawait client.connect();\n\n// Generate images\nconst images = await client.getImages(prompt);\n\n// Save images to file\nconst outputDir = './tmp/output';\nawait client.saveImages(images, outputDir);\n\n// Disconnect\nawait client.disconnect();\n```\n\n## License\n\nThis project is licensed under the [MIT License][license].\n\n[badge-version]: https://img.shields.io/npm/v/comfy-ui-client.svg\n[badge-license]: https://img.shields.io/npm/l/comfy-ui-client.svg\n\n[npm]: https://www.npmjs.com/package/comfy-ui-client\n[license]: https://github.com/itsKaynine/comfy-ui-client/blob/main/LICENSE\n\n[examples-generate]: https://github.com/itsKaynine/comfy-ui-client/tree/main/examples/generate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitskaynine%2Fcomfy-ui-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitskaynine%2Fcomfy-ui-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitskaynine%2Fcomfy-ui-client/lists"}