Full-featured TypeScript solution to work with generative-AI and ComfyUI. Best-in-class, type-safe, easy to use, production-ready, and battle-tested.
🔴 DISCLAIMER: This (comfy-ts
) package is beeing extracted from CushyStudio. Extraction is Unfinished 🔴
yarn add comfy-ts
npm install comfy-ts
pnpm install comfy-ts
import { ComfyTS } from '../state'
const comfy = new ComfyTS()
// 1. create a host
const host = comfy.defineHost({ id: 'windows-1', hostname: 'localhost', port: 8085, useHttps: false, })
// 2. codegen types for models, custom-nodes, ...
await host.fetchAndUpdateSchema()
// 3. create a workflow
const workflow = host.createEmptyWorkflow({ id: 'simple' })
// 4. build a simple image-to-image workflow
const b = workflow.builder
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'revAnimated_v122.safetensors' })
const positive = b.CLIPTextEncode({ clip: ckpt, text: 'a house' })
const negative = b.CLIPTextEncode({ clip: ckpt, text: 'bad' })
const latent_image = b.EmptyLatentImage({ width: 512, height: 512, batch_size: 1 })
const images = b.VAEDecode({
vae: ckpt,
samples: b.KSampler({
model: ckpt,
sampler_name: 'ddim',
scheduler: 'ddim_uniform',
positive,
negative,
latent_image,
}),
})
b.PreviewImage({ images: images })
// 5. execute your workflow
await workflow.PROMPT()
// 6. retrieve outputs
// ....
// 7. print summary
✅ Install, manage, and start ComfyUI via the official ComfyUI cli
✅ configure ComfyUI
✅ generate a fully type-safe SDK with
✅ build workflows programmatic
✅ run workflows
✅ Maintain a type-safe up-to-date community Library of all known nodes to help make workflows
Years of experience in building type-safe SDKs and APIs, this package is built with TypeScript in mind from the ground up, and pay attention to typechecking speed for the smoothest developer experience possible.
Some features of the SDK have been refined for years to provide the best developer experience possible when creating workflow from scratch.
🔴 DISCLAIMER: This (comfy-ts
) package is beeing extracted from CushyStudio. Extraction is Unfinished 🔴