Phase 3: Server API Routes (/api/comfyui/*)

Add FastAPI routes for ComfyUI programmatic API:

Query endpoints:
- GET /api/comfyui/status - System stats (GPU, RAM, etc.)
- GET /api/comfyui/queue - Queue status (running/pending)
- DELETE /api/comfyui/queue - Clear the queue
- GET /api/comfyui/models - List available models
- GET /api/comfyui/history - List generation history
- GET /api/comfyui/history/{prompt_id} - Get specific result

Generation endpoints:
- POST /api/comfyui/generate - Text-to-image with full params
- POST /api/comfyui/workflow - Queue arbitrary API-format workflow

All endpoints protected with API key auth (X-API-Key header).
Pydantic models for request/response validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-16 16:11:19 +01:00
parent c8c93596c8
commit 484c52faf3
3 changed files with 282 additions and 3 deletions
+3 -3
View File
@@ -27,17 +27,17 @@
- Rich progress output via console
## Phase 3: Server API Routes (`tensors/server/comfyui_api_routes.py`)
- [ ] Step 3.1: Create new router with query endpoints
- [x] Step 3.1: Create new router with query endpoints
- `GET /api/comfyui/status` - System stats
- `GET /api/comfyui/queue` - Queue status
- `DELETE /api/comfyui/queue` - Clear queue
- `GET /api/comfyui/models` - List loaded models
- `GET /api/comfyui/history` - List history
- `GET /api/comfyui/history/{prompt_id}` - Get specific result
- [ ] Step 3.2: Add generation endpoints
- [x] Step 3.2: Add generation endpoints
- `POST /api/comfyui/generate` - Text-to-image generation
- `POST /api/comfyui/workflow` - Run arbitrary workflow
- [ ] Step 3.3: Register router in server/__init__.py
- [x] Step 3.3: Register router in server/__init__.py (with API key auth)
## Phase 4: Configuration (`tensors/config.py`)
- [ ] Step 4.1: Add ComfyUI config functions