comfy-ts 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ Every `*.cflow.ts` file here is a runnable workflow module: run it directly with
8
8
  - `rvion/05-comfy-cloud.cflow.ts` — the same t2i against [Comfy Cloud] (https://cloud.comfy.org): no local GPU needed, the typed catalog ships committed at `comfy-cloud/sdk.d.ts`.
9
9
  - `rvion/06-qwen-image-edit.cflow.ts` — image editing (qwen image edit 2511) against the same local host.
10
10
  - `rvion/07-local-llm-text-gen.cflow.ts` — a local LLM, no image: core's `TextGenerate` runs a chat model loaded through `CLIPLoader`, and the text comes back in `execution.text`. `--sweep` reports which text encoders on your host actually generate.
11
+ - `rvion/08-qwen-image-21-t2i.cflow.ts` / `rvion/09-qwen-image-21-edit.cflow.ts` — Qwen Image 2.1 (ComfyUI ≥ 0.37) against the same local host: text to image, and instruction editing of one reference image (its `remove background` preset is the official background-removal template).
11
12
  - `comfy-cloud/<family>-<mode>.cflow.ts` — the model zoo: one clean example per model family × mode (`t2i`, `i2i`, `t2v`, `i2v`, `t2a`), each mirroring an official ComfyUI template (flux, qwen-image, z-image, wan, hidream, ace-step, …). All share `comfy-cloud/cloudHost.ts`.
12
13
 
13
14
  ## Cloud API key
@@ -0,0 +1,152 @@
1
+ // ltx25 i2v on Comfy Cloud — LTX-2.5 22b distilled, image to video WITH a generated soundtrack: the start image drives both passes
2
+ // source template: video_ltx2_5_i2v.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // note: video outputs PERSIST on the host (upstream ships no websocket saver for video — image examples stream ephemerally)
5
+ // run directly: bun examples/comfy-cloud/ltx25-i2v.cflow.ts [path/to/image.png] ["prompt"]
6
+ import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
7
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
8
+
9
+ const host = await cloudHost()
10
+
11
+ // bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
12
+ const image = v.image(exampleImagePath('walrus_1344x768.jpg'))
13
+
14
+ export const ltx25I2v = host.defineWorkflow({
15
+ id: 'ltx25-i2v',
16
+ vars: {
17
+ image,
18
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
19
+ prompt: v.prompt(
20
+ 'The walrus slowly lifts its head and turns toward the camera, whiskers twitching, breath fogging in the cold air. Waves lap against the rocks behind it, gulls cry in the distance, and it lets out a deep, rumbling bellow.\n- pc game, console game, video game, cartoon, childish, ugly',
21
+ ),
22
+ seed: v.seed(42),
23
+ // the OUTPUT size: the first pass samples at half of it, the latent upscaler doubles it
24
+ size: v.size({ width: 1280, height: 704 }),
25
+ length: v.int(121, { min: 9, max: 481 }),
26
+ fps: v.int(24, { min: 1, max: 60 }),
27
+ },
28
+ // async build: the input image is uploaded (hash-named, deduped) per run
29
+ build: async (b, vars, wf) => {
30
+ const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
31
+ const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
32
+
33
+ const model = b.UNETLoader({
34
+ unet_name: 'ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors',
35
+ weight_dtype: 'default',
36
+ })
37
+ const clip = b.CLIPLoader({
38
+ clip_name: 'gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors',
39
+ type: 'ltxv',
40
+ device: 'default',
41
+ })
42
+ const vae = b.VAELoader({ vae_name: 'ltx-2.5-video-vae-bf16.safetensors' })
43
+ const audioVae = b.VAELoader({ vae_name: 'ltx-2.5-audio-vae-bf16.safetensors' })
44
+
45
+ // the start image, capped at 1536px and re-compressed the way ltx was trained on video frames
46
+ const start = b.LTXVPreprocess({
47
+ image: b.ImageScaleToMaxDimension({ image: loaded, upscale_method: 'lanczos', largest_size: 1536 }),
48
+ img_compression: 18,
49
+ }).outputs.output_image
50
+
51
+ const cond = b.LTXVConditioning({
52
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
53
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
54
+ frame_rate: vars.fps,
55
+ })
56
+ // distilled: cfg 1 on both streams, and hand-set sigma schedules instead of a step count
57
+ const guider = b.LTXVDualCFGGuider({
58
+ model,
59
+ positive: cond.outputs.positive,
60
+ negative: cond.outputs.negative,
61
+ video_cfg: 1,
62
+ audio_cfg: 1,
63
+ })
64
+ const sampler = b.KSamplerSelect({ sampler_name: 'euler_ancestral' })
65
+ const noise = b.RandomNoise({ noise_seed: vars.seed })
66
+
67
+ // pass 1: half resolution, the start image written into the first frame at strength 0.7
68
+ const base = b.SamplerCustomAdvanced({
69
+ noise,
70
+ guider,
71
+ sampler,
72
+ sigmas: b.ManualSigmas({ sigmas: '1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0' }),
73
+ latent_image: b.LTXVConcatAVLatent({
74
+ video_latent: b.LTXVImgToVideoInplace({
75
+ vae,
76
+ image: start,
77
+ latent: b.EmptyLTXVLatentVideo({
78
+ width: Math.round(vars.size.width / 2),
79
+ height: Math.round(vars.size.height / 2),
80
+ length: vars.length,
81
+ batch_size: 1,
82
+ }),
83
+ strength: 0.7,
84
+ bypass: false,
85
+ }),
86
+ audio_latent: b.LTXVEmptyLatentAudio({
87
+ frames_number: vars.length,
88
+ frame_rate: vars.fps,
89
+ batch_size: 1,
90
+ audio_vae: audioVae,
91
+ }),
92
+ }),
93
+ })
94
+ const baseAv = b.LTXVSeparateAVLatent({ av_latent: base.outputs.output })
95
+
96
+ // pass 2: x2 latent upscale, the start image pinned again at full strength, then a short refine
97
+ const refined = b.SamplerCustomAdvanced({
98
+ noise,
99
+ guider,
100
+ sampler,
101
+ sigmas: b.ManualSigmas({ sigmas: '0.85, 0.7250, 0.4219, 0.0' }),
102
+ latent_image: b.LTXVConcatAVLatent({
103
+ video_latent: b.LTXVImgToVideoInplace({
104
+ vae,
105
+ image: start,
106
+ latent: b.LTXVLatentUpsampler({
107
+ samples: baseAv.outputs.video_latent,
108
+ upscale_model: b.LatentUpscaleModelLoader({
109
+ model_name: 'ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors',
110
+ }),
111
+ vae,
112
+ }),
113
+ strength: 1,
114
+ bypass: false,
115
+ }),
116
+ audio_latent: baseAv.outputs.audio_latent,
117
+ }),
118
+ })
119
+ const av = b.LTXVSeparateAVLatent({ av_latent: refined.outputs.output })
120
+
121
+ b.SaveVideo({
122
+ video: b.CreateVideo({
123
+ images: b.VAEDecodeTiled({
124
+ samples: av.outputs.video_latent,
125
+ vae,
126
+ tile_size: 512,
127
+ overlap: 64,
128
+ temporal_size: 64,
129
+ temporal_overlap: 16,
130
+ }),
131
+ audio: b.LTXVAudioVAEDecode({ samples: av.outputs.audio_latent, audio_vae: audioVae }),
132
+ fps: vars.fps,
133
+ }),
134
+ filename_prefix: 'comfy-ts-zoo/ltx25-i2v',
135
+ format: 'auto',
136
+ codec: 'auto',
137
+ })
138
+ },
139
+ })
140
+
141
+ export default ltx25I2v
142
+
143
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
144
+ if (import.meta.main) {
145
+ requireCloudKey()
146
+ if (process.argv[2]) ltx25I2v.vars.image.set(process.argv[2])
147
+ if (process.argv[3]) ltx25I2v.vars.prompt.set(process.argv[3])
148
+ const execution = await ltx25I2v.run({ log: true })
149
+ // SaveVideo outputs land host side (no auto-download for video yet)
150
+ console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltx25-i2v`)
151
+ host.disconnect()
152
+ }
@@ -0,0 +1,126 @@
1
+ // ltx25 t2v on Comfy Cloud — LTX-2.5 22b distilled, text to video WITH a generated soundtrack, 121 frames @ 24fps ≈ 5s
2
+ // source template: video_ltx2_5_t2v.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // note: video outputs PERSIST on the host (upstream ships no websocket saver for video — image examples stream ephemerally)
5
+ // run directly: bun examples/comfy-cloud/ltx25-t2v.cflow.ts ["prompt"] [seed]
6
+ import { v } from 'comfy-ts'
7
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
8
+
9
+ const host = await cloudHost()
10
+
11
+ export const ltx25T2v = host.defineWorkflow({
12
+ id: 'ltx25-t2v',
13
+ vars: {
14
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
15
+ prompt: v.prompt(
16
+ 'A close-up of an Arctic hunter\'s face, his eyes fixed straight ahead, narrowed and locked on something beyond the frame. Snow whips across his fur-lined hood, wind howls, and he whispers: "it\'s close now."\n- pc game, console game, video game, cartoon, childish, ugly',
17
+ ),
18
+ seed: v.seed(42),
19
+ // the OUTPUT size: the first pass samples at half of it, the latent upscaler doubles it
20
+ size: v.size({ width: 1280, height: 704 }),
21
+ length: v.int(121, { min: 9, max: 481 }),
22
+ fps: v.int(24, { min: 1, max: 60 }),
23
+ },
24
+ build: (b, vars) => {
25
+ const model = b.UNETLoader({
26
+ unet_name: 'ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors',
27
+ weight_dtype: 'default',
28
+ })
29
+ const clip = b.CLIPLoader({
30
+ clip_name: 'gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors',
31
+ type: 'ltxv',
32
+ device: 'default',
33
+ })
34
+ const vae = b.VAELoader({ vae_name: 'ltx-2.5-video-vae-bf16.safetensors' })
35
+ const audioVae = b.VAELoader({ vae_name: 'ltx-2.5-audio-vae-bf16.safetensors' })
36
+
37
+ const cond = b.LTXVConditioning({
38
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
39
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
40
+ frame_rate: vars.fps,
41
+ })
42
+ // distilled: cfg 1 on both streams, and hand-set sigma schedules instead of a step count
43
+ const guider = b.LTXVDualCFGGuider({
44
+ model,
45
+ positive: cond.outputs.positive,
46
+ negative: cond.outputs.negative,
47
+ video_cfg: 1,
48
+ audio_cfg: 1,
49
+ })
50
+ const sampler = b.KSamplerSelect({ sampler_name: 'euler_ancestral' })
51
+ const noise = b.RandomNoise({ noise_seed: vars.seed })
52
+
53
+ // pass 1: video + audio latents sampled together at half resolution
54
+ const base = b.SamplerCustomAdvanced({
55
+ noise,
56
+ guider,
57
+ sampler,
58
+ sigmas: b.ManualSigmas({ sigmas: '1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0' }),
59
+ latent_image: b.LTXVConcatAVLatent({
60
+ video_latent: b.EmptyLTXVLatentVideo({
61
+ width: Math.round(vars.size.width / 2),
62
+ height: Math.round(vars.size.height / 2),
63
+ length: vars.length,
64
+ batch_size: 1,
65
+ }),
66
+ audio_latent: b.LTXVEmptyLatentAudio({
67
+ frames_number: vars.length,
68
+ frame_rate: vars.fps,
69
+ batch_size: 1,
70
+ audio_vae: audioVae,
71
+ }),
72
+ }),
73
+ })
74
+ const baseAv = b.LTXVSeparateAVLatent({ av_latent: base.outputs.output })
75
+
76
+ // pass 2: x2 latent upscale of the video, then a short refine over the rejoined av latent
77
+ const refined = b.SamplerCustomAdvanced({
78
+ noise,
79
+ guider,
80
+ sampler,
81
+ sigmas: b.ManualSigmas({ sigmas: '0.85, 0.7250, 0.4219, 0.0' }),
82
+ latent_image: b.LTXVConcatAVLatent({
83
+ video_latent: b.LTXVLatentUpsampler({
84
+ samples: baseAv.outputs.video_latent,
85
+ upscale_model: b.LatentUpscaleModelLoader({
86
+ model_name: 'ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors',
87
+ }),
88
+ vae,
89
+ }),
90
+ audio_latent: baseAv.outputs.audio_latent,
91
+ }),
92
+ })
93
+ const av = b.LTXVSeparateAVLatent({ av_latent: refined.outputs.output })
94
+
95
+ b.SaveVideo({
96
+ video: b.CreateVideo({
97
+ images: b.VAEDecodeTiled({
98
+ samples: av.outputs.video_latent,
99
+ vae,
100
+ tile_size: 512,
101
+ overlap: 64,
102
+ temporal_size: 64,
103
+ temporal_overlap: 16,
104
+ }),
105
+ audio: b.LTXVAudioVAEDecode({ samples: av.outputs.audio_latent, audio_vae: audioVae }),
106
+ fps: vars.fps,
107
+ }),
108
+ filename_prefix: 'comfy-ts-zoo/ltx25-t2v',
109
+ format: 'auto',
110
+ codec: 'auto',
111
+ })
112
+ },
113
+ })
114
+
115
+ export default ltx25T2v
116
+
117
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
118
+ if (import.meta.main) {
119
+ requireCloudKey()
120
+ if (process.argv[2]) ltx25T2v.vars.prompt.set(process.argv[2])
121
+ if (process.argv[3]) ltx25T2v.vars.seed.set(Number(process.argv[3]))
122
+ const execution = await ltx25T2v.run({ log: true })
123
+ // SaveVideo outputs land host side (no auto-download for video yet)
124
+ console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltx25-t2v`)
125
+ host.disconnect()
126
+ }
@@ -0,0 +1,95 @@
1
+ // minimax-music3 t2a on Comfy Cloud — MiniMax Music 3 text to song: a structured caption + tagged lyrics to a full mp3 track
2
+ // source template: audio_minimax_music_3.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // note: audio outputs PERSIST on the host (upstream ships no websocket saver for audio — image examples stream ephemerally)
5
+ // run directly: bun examples/comfy-cloud/minimax-music3-t2a.cflow.ts ["prompt"] [seed]
6
+ import { v } from 'comfy-ts'
7
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
8
+
9
+ const host = await cloudHost()
10
+
11
+ export const minimaxMusic3T2a = host.defineWorkflow({
12
+ id: 'minimax-music3-t2a',
13
+ vars: {
14
+ // ONE prompt var: FIRST line = the caption (Global Metadata → Vocal Details → Arrangement), remaining lines = lyrics
15
+ // with [Intro] [Verse] [Chorus] [Bridge] [Outro] tags, the only structural instructions the model follows (`//` lines are comments)
16
+ prompt: v.prompt(
17
+ [
18
+ 'Global Metadata: Lo-fi hip-hop, chillhop. 78 BPM, D flat major, jazzy extensions. Laid-back and dreamy, a warm late-night glow, heavy vinyl crackle and tape hiss. Vocal Details: Soft androgynous vocal, hushed half-sung half-spoken delivery, low in the mix, occasional wordless "mmm" and "ooh" hums in tape delay. Arrangement: Dusty boom-bap drums, round sub bass, warm Rhodes chords, mellow jazzy guitar licks; rain and vinyl noise intro, drums drop away in the bridge, fade out on a last Rhodes chord.',
19
+ '',
20
+ '[Intro]',
21
+ 'Mmm...',
22
+ '(rain on the window)',
23
+ '',
24
+ '[Verse]',
25
+ 'Midnight and the canvas glows',
26
+ 'Dragging little wires where the current flows',
27
+ 'Type a quiet dream, let the sampler drift',
28
+ 'Noise into a picture, like the fog just lifts',
29
+ '',
30
+ '[Chorus]',
31
+ 'Mmm... let it render on',
32
+ '(take your time, take your time)',
33
+ 'Ooh... by the morning it will all be done',
34
+ '',
35
+ '[Outro]',
36
+ 'Mmm...',
37
+ 'Ooh... goodnight',
38
+ ].join('\n'),
39
+ ),
40
+ seed: v.seed(42),
41
+ // an upper bound: the model can end the song earlier
42
+ seconds: v.float(60, { min: 1, max: 300 }),
43
+ steps: v.int(30, { min: 1, max: 100 }),
44
+ },
45
+ build: (b, vars) => {
46
+ const [captionLine, ...lyricLines] = vars.prompt.positive.split('\n')
47
+ const encoded = b.MiniMaxMusic3TextEncode({
48
+ clip: b.CLIPLoader({
49
+ clip_name: 'minimax_music3_text_encoder_pruned_int8_convrot.safetensors',
50
+ type: 'minimax',
51
+ device: 'default',
52
+ }),
53
+ caption: captionLine ?? '',
54
+ lyrics: lyricLines.join('\n').trim(),
55
+ seed: vars.seed,
56
+ max_duration: vars.seconds,
57
+ cfg_scale: 1.7,
58
+ top_k: 50,
59
+ })
60
+ const vae = b.VAELoader({ vae_name: 'minimax_music3_dav.safetensors' })
61
+ const samples = b.KSampler({
62
+ model: b.UNETLoader({ unet_name: 'minimax_music3_dit_fp16.safetensors', weight_dtype: 'default' }),
63
+ positive: encoded.outputs.CONDITIONING,
64
+ negative: b.ConditioningZeroOut({ conditioning: encoded.outputs.CONDITIONING }),
65
+ // the encoder reports the duration it planned for the lyrics, the latent is sized from it
66
+ latent_image: b.EmptyMiniMaxMusic3LatentAudio({ seconds: encoded.outputs.seconds, batch_size: 1 }),
67
+ seed: vars.seed,
68
+ steps: vars.steps,
69
+ cfg: 1.7,
70
+ sampler_name: 'euler',
71
+ scheduler: 'simple',
72
+ denoise: 1,
73
+ })
74
+ b.SaveAudioAdvanced({
75
+ // tiled decode: the template default, it keeps long songs inside VRAM
76
+ audio: b.VAEDecodeAudioTiled({ samples, vae, tile_size: 1536, overlap: 64 }),
77
+ filename_prefix: 'comfy-ts-zoo/minimax-music3-t2a',
78
+ format: 'mp3',
79
+ 'format.quality': 'V0',
80
+ })
81
+ },
82
+ })
83
+
84
+ export default minimaxMusic3T2a
85
+
86
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
87
+ if (import.meta.main) {
88
+ requireCloudKey()
89
+ if (process.argv[2]) minimaxMusic3T2a.vars.prompt.set(process.argv[2])
90
+ if (process.argv[3]) minimaxMusic3T2a.vars.seed.set(Number(process.argv[3]))
91
+ const execution = await minimaxMusic3T2a.run({ log: true })
92
+ // SaveAudio outputs land host side (no auto-download for audio yet)
93
+ console.log(`🟢 ${execution.status}: audio saved on the host under comfy-ts-zoo/minimax-music3-t2a`)
94
+ host.disconnect()
95
+ }