Comfy-Swap exposes ComfyUI workflows as stable, production-ready APIs. It bridges the gap between ComfyUI's visual workflow design and real-world application integration.
AI agents (Claude Code, Cursor, Codex, etc.) can install the comfy-swap skill to automate image generation workflows.
Install skill (recommended methods, in order):
# 1. Via skills.sh (universal, works with most agents)
npx skills add kamjin3086/comfy-swap-skill
# 2. Via openskills (Claude Code compatible)
npx openskills install kamjin3086/comfy-swap-skill
# 3. Manual clone (fallback)
git clone https://github.com/kamjin3086/comfy-swap-skill.git ~/.agents/skills/comfy-swapAfter installation, agents can run comfy-swap health to verify setup, then use CLI commands to list workflows, run generations, and manage parameters.
Skill repository: kamjin3086/comfy-swap-skill
Comfy-Swap turns complex ComfyUI workflows into simple, unified API endpoints that are:
- AI Agent Friendly — Clean JSON interface, predictable parameters, easy for LLMs and automation tools to call
- Developer Friendly — Same workflow, same parameters, whether you use REST API or CLI
- Production Ready — Stable API contracts that don't break when you update your workflow internals
curl -X POST 'http://localhost:8189/api/prompt' \
-H 'Content-Type: application/json' \
-d '{
"workflow_id": "portrait-gen",
"params": {
"prompt": "professional headshot, studio lighting",
"seed": 42
}
}'comfy-swap run portrait-gen prompt="professional headshot" seed=42 --wait --save ./output/Same workflow. Same parameters. Choose your interface.
| Problem | Solution |
|---|---|
| ComfyUI workflows are complex JSON with node IDs | Comfy-Swap provides named parameters like prompt, seed, image |
| Changing workflow internals breaks integrations | Parameter mapping keeps your API stable |
| Hard to call from scripts, agents, or automation | Simple REST/CLI with consistent interface |
| No unified way to track API usage | Built-in request logging with filtering |
- Workflow → API: Export any ComfyUI workflow as a callable API endpoint
- Parameter Mapping: Map friendly names to internal node fields (one param → multiple nodes)
- Dual Interface: REST API and CLI share identical parameters
- Image I/O: Upload images as inputs, download generated outputs
- Request Logs: Track all API calls with workflow filtering and time range
- Web Playground: Test workflows interactively before integration
- Backup/Restore: Export all configurations for migration
Comfy-Swap focuses on workflow exposure and API integration. It intentionally does not:
- ❌ Manage ComfyUI installation or updates
- ❌ Install or manage custom nodes
- ❌ Provide workflow editing UI
- ❌ Replace ComfyUI's execution engine
These are handled by ComfyUI itself or ComfyUI Manager.
Download the latest release for your platform from Releases.
Add to PATH for global access (recommended):
Windows (PowerShell)
# Copy to a PATH location (easiest)
Copy-Item comfy-swap.exe -Destination "$env:LOCALAPPDATA\Microsoft\WindowsApps\"
# Or add custom directory to PATH permanently
$binPath = "C:\path\to\comfy-swap"
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$binPath", "User")macOS / Linux
# Move to a standard PATH location
sudo mv comfy-swap /usr/local/bin/
# Or add to PATH in shell profile
echo 'export PATH="$PATH:/path/to/comfy-swap-dir"' >> ~/.bashrc
source ~/.bashrcVerify installation: comfy-swap version
comfy-swap serveOpen http://localhost:8189 to complete setup.
Build from source:
git clone+go build -o comfy-swap .(requires Go 1.21+)
Option A: Git Clone (Recommended)
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/kamjin3086/ComfyUI-ComfySwap.gitRestart ComfyUI after installation.
Option B: Download ZIP
- Open Comfy-Swap web UI (
http://localhost:8189) - Go to Settings → Plugin Installation → Download
- Click Download Plugin ZIP
- Extract to
ComfyUI/custom_nodes/ComfyUI-ComfySwap - Restart ComfyUI
In ComfyUI: Right-click canvas → Export to ComfySwap → Configure parameters → Swap
This makes your workflow available through Comfy-Swap's unified API and CLI interface.
# REST API
curl -X POST 'http://localhost:8189/api/prompt' \
-H 'Content-Type: application/json' \
-d '{"workflow_id": "my-workflow", "params": {"prompt": "a cat"}}'
# CLI
comfy-swap run my-workflow prompt="a cat" --wait# Show all commands and options
comfy-swap --help
comfy-swap run --help| Command | Description |
|---|---|
serve |
Start HTTP server |
config get/set |
View or update configuration |
list |
List all workflows |
info <id> |
Show workflow details |
import |
Import workflow from JSON or sync pending |
workflow |
Manage workflow parameters (nodes, add-param, update-param, etc.) |
run <id> key=value |
Execute workflow |
status <prompt_id> |
Check execution status |
result <prompt_id> |
Get results (with --save) |
logs |
View request logs |
health |
Server health check |
Global flags: -s, --server (server URL), -q, --quiet, --json, --pretty
| Endpoint | Method | Description |
|---|---|---|
/api/prompt |
POST | Execute workflow |
/api/workflows |
GET | List workflows |
/api/workflows/{id} |
GET | Get workflow details |
/api/history/{prompt_id} |
GET | Execution history |
/api/logs |
GET | Request logs |
/api/upload |
POST | Upload image |
/api/view |
GET | Download output |
{
"name": "seed",
"type": "integer",
"default": -1,
"description": "Random seed, -1 for random",
"targets": [
{ "node_id": "3", "field": "seed" },
{ "node_id": "9", "field": "seed" }
]
}One seed parameter automatically updates multiple nodes. Your API stays clean.




