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 Web 应用中。

功能
为在 Python 和 FastAPI Web 应用中调用 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 从公开仓库中收录这些内容。

举报或申请下架