ComfyUI Workflow Templates

0.9.45 · active · verified Fri Apr 10

The `comfyui-workflow-templates` library provides a convenient Python package to access a collection of pre-defined ComfyUI workflow JSONs. It allows developers to easily retrieve and use these templates programmatically, streamlining the creation and sharing of ComfyUI workflows. The current version is 0.9.45, with updates typically released as new templates are added or existing ones are refined.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to list available ComfyUI workflow templates and retrieve a specific one by name using the `comfyui_workflow_templates` package. The retrieved template is a standard Python dictionary representing the ComfyUI workflow JSON.

import comfyui_workflow_templates as cwt
import json

# List all available templates
print("Available templates:", cwt.list_templates()[:5], "...")

# Get a specific template by name (e.g., 'sdxl_base_workflow')
# Note: Template names can change; check available_templates if unsure.
try:
    template_name = "sdxl_base_workflow" # This is an example, verify with list_templates()
    workflow_json = cwt.get_workflow_template(template_name)
    print(f"\nSuccessfully loaded template '{template_name}'.")
    # print(json.dumps(workflow_json, indent=2))
    print(f"Template keys (top-level): {list(workflow_json.keys())}")
except KeyError as e:
    print(f"\nError: Template '{template_name}' not found. Available templates might have changed.")
    print("Consider using `cwt.list_templates()` to see current names.")

view raw JSON →