This repository has been archived on 2026-10-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00
2026-01-03 14:42:05 -07:00

External API Custom Node

REST API endpoints for executing ComfyScript workflows.

Structure

external-api/
├── __init__.py           # Main entry point, registers routes
├── progress.py           # Progress hook utilities
├── routes.py             # API endpoint definitions
├── workflows.py          # Workflow registry
└── workflows/            # Individual workflow scripts
    ├── test.py
    └── example_image_gen.py

Adding New Workflows

  1. Create a new file in workflows/ folder (e.g., my_workflow.py)
  2. Define a run_workflow(**kwargs) function
  3. Import and register it in workflows.py:
# In workflows.py
my_workflow = load_workflow_module("my_workflow")

WORKFLOWS = {
    "my_workflow": my_workflow.run_workflow,
    # ... other workflows
}

API Endpoints

List Available Workflows

GET /external-api/workflows

Execute Workflow

POST /external-api/workflow/{workflow_name}
Content-Type: application/json

{
  "prompt": "a beautiful landscape",
  "steps": 20,
  "seed": 12345
}

Test Endpoint

GET /external-api/hello

Example Usage

# List workflows
curl http://localhost:8188/external-api/workflows

# Execute test workflow
curl -X POST http://localhost:8188/external-api/workflow/test_workflow \
  -H "Content-Type: application/json" \
  -d '{"prompt": "test", "steps": 10}'

Workflow Template

Each workflow file should follow this pattern:

def run_workflow(**kwargs):
    """
    Your workflow description.

    Args:
        **kwargs: Workflow parameters

    Returns:
        dict: Result with status and output
    """
    from comfy_script.runtime import *
    load('http://127.0.0.1:8188/')
    from comfy_script.runtime.nodes import *

    # Your workflow logic here
    with Workflow(wait=True) as wf:
        # ... nodes ...
        pass

    return {
        'status': 'completed',
        'output': result
    }
S
Description
No description provided
Readme
172 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%