메인 콘텐츠로 건너뛰기
PR #8041부터 ComfyUI는 특정 프론트엔드 인터페이스가 필요 없이 ComfyUI 계정 API 키를 통해 내장된 유료 파트너 노드를 직접 사용할 수 있도록 지원합니다(프론트엔드 없이 실행할 수도 있습니다). 이는 다음과 같은 요소를 결합한 워크플로우를 생성할 수 있음을 의미합니다:
  • 로컬 OS 모델
  • 맞춤형 노드 커뮤니티의 도구
  • 인기 있는 유료 모델
그런 다음 Comfy 웹서버 API에 단순히 프롬프트를 보내 모든 작업을 함께 실행하며, 모든 오케스트레이션을 처리하도록 할 수 있습니다. 이는 Comfy를 백엔드 서비스로 사용하고자 하는 사용자나 명령줄을 통해 자신의 프론트엔드와 함께 사용하는 경우 등에 유용합니다.

사전 요구사항

유료 파트너 노드를 호출하려면 ComfyUI 계정 API 키가 필요합니다:
중요: 이 페이지는 워크플로우에서 유료 파트너 노드에 접근하는 데 사용되는 ComfyUI 계정 API 키를 설명합니다. 만약 맞춤형 노드를 레지스트리에 게시하려는 경우, 노드 게시하기를 참조하세요.
ComfyUI 계정 API 키를 사용해 유료 파트너 노드를 호출하려면 먼저 ComfyUI 플랫폼에서 계정을 등록하고 API 키를 생성해야 합니다. ComfyUI 계정에 해당 기능을 테스트할 만큼 충분한 크레딧이 있는지 확인해야 합니다.

크레딧

계정의 크레딧을 구매하는 방법은 크레딧 섹션을 참고하세요.

파이썬 예제

다음은 파이썬 코드를 사용해 파트너 노드를 포함한 워크플로우를 ComfyUI API로 전송하는 예시입니다:
"""Using Partner Nodes when running ComfyUI headless or with alternative frontend

You can execute a ComfyUI workflow that contains Partner Nodes by including an API key in the prompt.
The API key should be added to the `extra_data` field of the payload.
Below we show an example of how to do this.

See more:

- Partner Nodes overview: https://docs.comfy.org/tutorials/partner-nodes/overview
- To generate an API key, login here: https://platform.comfy.org/login
"""

import json
from urllib import request

SERVER_URL = "http://127.0.0.1:8188"

# We have a prompt/job (workflow in "API format") that contains Partner Nodes.
workflow_with_api_nodes = """{
  "11": {
    "inputs": {
      "prompt": "A dreamy, surreal half-body portrait of a young woman meditating. She has a short, straight bob haircut dyed in pastel pink, with soft bangs covering her forehead. Her eyes are gently closed, and her hands are raised in a calm, open-palmed meditative pose, fingers slightly curved, as if levitating or in deep concentration. She wears a colorful dress made of patchwork-like pastel tiles, featuring clouds, stars, and rainbows. Around her float translucent, iridescent soap bubbles reflecting the rainbow hues. The background is a fantastical sky filled with cotton-candy clouds and vivid rainbow waves, giving the entire scene a magical, dreamlike atmosphere. Emphasis on youthful serenity, whimsical ambiance, and vibrant soft lighting.",
      "prompt_upsampling": false,
      "seed": 589991183902375,
      "aspect_ratio": "1:1",
      "raw": false,
      "image_prompt_strength": 0.4000000000000001,
      "image_prompt": [
        "14",
        0
      ]
    },
    "class_type": "FluxProUltraImageNode",
    "_meta": {
      "title": "Flux 1.1 [pro] Ultra Image"
    }
  },
  "12": {
    "inputs": {
      "filename_prefix": "ComfyUI",
      "images": [
        "11",
        0
      ]
    },
    "class_type": "SaveImage",
    "_meta": {
      "title": "Save Image"
    }
  },
  "14": {
    "inputs": {
      "image": "example.png"
    },
    "class_type": "LoadImage",
    "_meta": {
      "title": "Load Image"
    }
  }
}"""


prompt = json.loads(workflow_with_api_nodes)
payload = {
    "prompt": prompt,
    # Add the `api_key_comfy_org` to the payload.
    # You can first get the key from the associated user if handling multiple clients.
    "extra_data": {
        "api_key_comfy_org": "comfyui-87d01e28d*******************************************************"  # replace with actual key
    },
}
data = json.dumps(payload).encode("utf-8")
req = request.Request(f"{SERVER_URL}/prompt", data=data)
request.urlopen(req)

관련 문서