Skip to main content

Models API by ComfyDeploy

A collection of optimized ComfyUI-based cloud inference endpoints, built on ComfyDeploy and Modal.

Features

  • Optimized model loading and caching
  • Cloud-based inference endpoints
  • Easy workflow management through CLI
  • Extensible workflow system

Installation

uv add comfy-models

Usage

CLI Commands

uv tool install comfy-models

The package provides several CLI commands to manage workflows:

# List all available workflows
models ls

# Show detailed info about a workflow
models cat <workflow_name>

# Deploy a workflow to Modal
models deploy <workflow_name>

# Run a workflow locally
models run <workflow_name>

# Test a workflow
models test <workflow_name>

Environment Setup

Create a .env file in your project root:

MODAL_VOLUME_NAME=your_modal_volume_name
HF_TOKEN=your_huggingface_token  # Optional, for private model access

Contributing New Workflows

To add a new workflow, follow these steps:

  1. Create a new directory under src/comfy_models/workflows/ with your workflow name
  2. Required files:
workflows/
└── your_workflow_name/
    ├── config.py          # Workflow configuration
    ├── runner.py          # Modal app definition
    ├── workflow.json      # ComfyUI workflow definition
    └── workflow_api.json  # API interface definition

Configuration (config.py)

from comfy_models.base.comfy_utils import Config

config = Config(
    name="your_workflow_name",
    models_to_cache=[
        "path/to/model1.safetensors",
        "path/to/model2.safetensors"
    ],
    warmup_workflow=True,  # Run workflow once on startup
    run_twice=False,       # Run workflow twice for testing
    nodes_to_preload=[]    # Nodes to initialize on startup
)

Runner (runner.py)

import uuid
from comfy_models.base.base_app import _ComfyDeployRunnerModelsDownloadOptimzedImports
import modal
from comfy_models.workflows.shared import get_configs
from comfy_models.workflows.your_workflow_name.config import config

APP_NAME = config.name
app = modal.App(APP_NAME)

@app.cls(
    **get_configs(APP_NAME),
    enable_memory_snapshot=True,
)
class ComfyDeployRunner(_ComfyDeployRunnerModelsDownloadOptimzedImports):
    config = config

@app.local_entrypoint()
def main():
    ComfyDeployRunner().run.remote({
        "prompt_id": str(uuid.uuid4()),
        "inputs": {
            "your_input": "your value"
        },
    })

Workflow Files

  • workflow.json: Export your workflow from ComfyUI
  • workflow_api.json: Define the API interface for your workflow using ComfyDeploy nodes

Example Workflows

Check out existing workflows in the workflows directory for reference:

  • flux_dev: Flux model with development settings
  • flux_schnell: Optimized Flux model
  • sd3_5_large: Stable Diffusion 3.5 large model

Metadata

Release files for comfy-models 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for comfy-models 0.1.5
File Size Uploaded Provenance
comfy_models-0.1.5.tar.gz 69.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for comfy-models 0.1.5
File Interpreter ABI Platform
comfy_models-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 117.8 kB

Release files / comfy_models-0.1.5.tar.gz

Download URL comfy_models-0.1.5.tar.gz
Size 69.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2f14216bf8c6e6563343d159a5d0556166f390014e12225a68e8031d104927e2
BLAKE2b-256 checksum
How to use checksums
f9541d037551ca04c5477376015a46a3c7cf9d9d54f2e3814ddbb8d81fc29246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.29

Release files / comfy_models-0.1.5-py3-none-any.whl

Download URL comfy_models-0.1.5-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecf8dc27473ca89684c7d6c0fb6bf78008e21e2b006ef80e784f921b42ad5e2e
BLAKE2b-256 checksum
How to use checksums
3bad12ef621586c0d5951dec306215b113b6ca24696fc71c85951632e05bca19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.29

Security for comfy-models 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page