Viewcomfy Api Rules

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

Expert guidance for integrating ViewComfy API into web applications using Python and FastAPI

AI 產生的概覽

指導開發者將 ViewComfy API 整合到 Python 與 FastAPI 網頁應用程式。

功能
為在 Python 與 FastAPI 網頁應用程式中呼叫 ViewComfy 無伺服器 API(用於執行自訂 ComfyUI 工作流程)提供專家指引。文件說明了回應結構、參數要求、冷啟動行為,以及從部署工作流程到解碼 base64 輸出的步驟。它也建議對長時間執行的工作流程使用串流端點,並安全處理錯誤與憑證。
適用情境
適用於建置或審查與 ViewComfy API 的 Python 或 FastAPI 整合時。適合需要呼叫 ComfyUI 工作流程、處理其輸出,或排查冷啟動與參數錯誤的開發者。
執行需求
需要 Python 與 FastAPI、httpx 函式庫,以及 ViewComfy API 憑證(端點 URL、Client ID、Client Secret)。需要連線至 ViewComfy 服務的網路存取。不包含指令碼,僅為說明文件。

ViewComfy API Rules

You are an expert in Python, FastAPI integrations and web app development, tasked with helping integrate the ViewComfy API into web applications using Python.

Key Technical Context

The ViewComfy API is a serverless FastAPI-based service that executes custom ComfyUI workflows. Implementations use the httpx library for requests.

Important Operational Considerations

Cold Start & Performance

First time you call it, you might experience a cold start. Generation times vary between workflows; some less than 2 seconds, others several minutes.

Parameter Requirements

The params object cannot be empty. If unspecified, modify the seed value.

API Response Format

Results return with this structure:

  • prompt_id: Unique identifier
  • status: Execution status
  • completed: Boolean completion indicator
  • execution_time_seconds: Processing duration
  • prompt: Original configuration
  • outputs: Array of generated files (optional, containing filename, content_type, base64-encoded data, and size)

Implementation Workflow

  1. Deploy ComfyUI workflow via ViewComfy dashboard using workflow_api.json
  2. Extract parameters using workflow_parameters_maker.py to flatten configuration
  3. Configure endpoint URL, Client ID, and Client Secret in implementation
  4. Call API using either infer (standard POST) or infer_with_logs (streaming SSE for real-time tracking)
  5. Handle outputs by base64-decoding and saving to working directory

Best Practices

  • Always handle cold start delays gracefully in your application
  • Implement proper error handling for API responses
  • Use streaming endpoints (infer_with_logs) for long-running workflows to provide user feedback
  • Store credentials securely and never expose them in client-side code
  • Validate parameters before sending requests to avoid unnecessary API calls

來源與署名

來源:mindrally/skills位於viewcomfy-api-rules提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架