ComfyUI × PopNow

ComfyUI에서 클라우드 AI 모델 실행하기

공식 PopNow 노드 팩으로 PopNow의 모든 이미지·영상·오디오 모델을 ComfyUI 그래프에 넣을 수 있습니다. ComfyUI Manager에서 바로 설치하세요. GPU도, 모델 다운로드도 필요 없습니다. 각 노드가 작업을 보내고 기다렸다가 결과를 다음 노드로 넘깁니다.

  1. Prompt
    text
    Epic fantasy landscape, photoreal matte…
  2. PopNow Generate
    model
    google/nano-banana-2.1/text-to-image
    options
    { }
  3. Preview Image
    잠자는 용
  1. Load Image
    내 사진
  2. PopNow Generate
    model
    bytedance/seedance-2.5/image-to-video
    image_field
    image_url
  3. Save Video

네 단계로 설치하기

  1. ComfyUI Manager에서 Custom Nodes Manager를 열고 PopNow를 검색해 Install을 누른 뒤 ComfyUI를 다시 시작합니다.
  2. API 키를 만들어 Settings > PopNow에 붙여 넣거나, POPNOW_API_KEY를 설정한 환경에서 ComfyUI를 실행합니다. 한 번 더 다시 시작하면 모델 목록을 불러옵니다.
  3. 캔버스를 더블클릭하고 kling이나 nano banana 같은 모델 이름을 입력합니다. PopNow Generate 노드에는 어떤 모델 이름이든 넣을 수 있습니다.
  4. 이미지를 받는 모델이면 Load Image를 연결하고, Save Image·Save Video·Save Audio 중 하나를 붙인 뒤 대기열에 넣습니다.

터미널에서는: comfy node install popnow-comfyui · Comfy Registry · GitHub

단일 파일로 설치하는 경우

노드 팩의 PopNow Generate 노드를 Python 파일 하나로 만든 것입니다. custom_nodes/popnow_api.py로 저장하고 POPNOW_API_KEY를 설정한 뒤 ComfyUI를 다시 시작하세요. ComfyUI에 이미 들어 있는 requests, Pillow, NumPy, PyTorch만 씁니다. 노드 팩과 이 파일 중 하나만 설치하세요.

custom_nodes/popnow_api.py
"""PopNow API node for ComfyUI.

Save as ComfyUI/custom_nodes/popnow_api.py, set POPNOW_API_KEY, restart ComfyUI.
Runs any PopNow image, video or audio model in the cloud and returns the result.
Same PopNow Generate node as the popnow-comfyui pack: install one or the other.
Docs: https://popnow.ai/docs
"""
import io
import json
import os
import time
import uuid

import numpy as np
import requests
import torch
from PIL import Image

import folder_paths

BASE = "https://api.popnow.ai/api/v1"
TERMINAL = ("succeeded", "failed", "canceled", "expired")


def _headers(extra=None):
    key = os.environ.get("POPNOW_API_KEY")
    if not key:
        raise RuntimeError("Set POPNOW_API_KEY before starting ComfyUI")
    return {"Authorization": f"Bearer {key}", **(extra or {})}


def _call(method, path, **kwargs):
    headers = _headers(kwargs.pop("headers", None))
    body = requests.request(method, BASE + path, headers=headers, timeout=60, **kwargs).json()
    if body.get("code") != 200:
        raise RuntimeError(f'PopNow {body.get("code")}: {body.get("msg")}')
    return body["data"]


def _upload(image):
    """IMAGE tensor -> PNG -> upload -> popnow:// reference."""
    arr = (image[0].cpu().numpy() * 255).clip(0, 255).astype(np.uint8)
    buf = io.BytesIO()
    Image.fromarray(arr).save(buf, format="PNG")
    data = buf.getvalue()
    ticket = _call("POST", "/common/upload-url", json={"contentType": "image/png", "bytes": len(data)})
    requests.put(ticket["uploadUrl"], data=data, headers=ticket.get("headers", {}), timeout=120).raise_for_status()
    return _call("POST", f'/files/{ticket["fileId"]}/commit')["uri"]


class PopNowGenerate:
    CATEGORY = "PopNow"
    RETURN_TYPES = ("IMAGE", "STRING", "STRING")
    RETURN_NAMES = ("image", "url", "path")
    FUNCTION = "run"

    @classmethod
    def INPUT_TYPES(cls):
        return {
            "required": {
                "model": ("STRING", {"default": "google/nano-banana-2.1/text-to-image"}),
                "prompt": ("STRING", {"multiline": True, "default": "A ceramic teapot on a linen cloth, soft window light, muted palette"}),
                "options": ("STRING", {"multiline": True, "default": "{\"aspect_ratio\":\"16:9\",\"resolution\":\"1k\",\"output_format\":\"png\"}"}),
            },
            "optional": {
                "image": ("IMAGE",),
                "image_field": ("STRING", {"default": "image_url"}),
            },
        }

    def run(self, model, prompt, options, image=None, image_field="image_url"):
        task_input = json.loads(options or "{}")
        if prompt.strip():
            task_input.setdefault("prompt", prompt)
        if image is not None:
            ref = _upload(image)
            task_input[image_field] = [ref] if image_field.endswith("s") else ref

        task_id = _call(
            "POST",
            "/jobs/createTask",
            headers={"Idempotency-Key": str(uuid.uuid4())},
            json={"model": model, "input": task_input},
        )["taskId"]

        delay = 2.0
        while True:
            time.sleep(delay)
            task = _call("GET", "/jobs/recordInfo", params={"taskId": task_id})
            assets = (task.get("output") or {}).get("assets") or []
            copying = any(a.get("pending") and not a.get("unavailable") for a in assets)
            if task["state"] in TERMINAL and not copying:
                break
            delay = min(delay * 1.5, 15.0)
        if task["state"] != "succeeded" or not assets:
            raise RuntimeError(f'PopNow {task["state"]}: {task.get("errorMessage", "no detail")}')

        asset = assets[0]
        content = requests.get(asset["url"], timeout=300).content
        mime = asset.get("mime", "")
        if mime.startswith("image/"):
            pil = Image.open(io.BytesIO(content)).convert("RGB")
            tensor = torch.from_numpy(np.asarray(pil).astype(np.float32) / 255.0)[None,]
            return (tensor, asset["url"], "")

        ext = {"video/mp4": ".mp4", "video/webm": ".webm", "audio/mpeg": ".mp3", "audio/wav": ".wav"}.get(mime, ".bin")
        path = os.path.join(folder_paths.get_output_directory(), f"popnow_{task_id}{ext}")
        with open(path, "wb") as f:
            f.write(content)
        # Video and audio: a small blank IMAGE keeps the graph valid; use the path output.
        return (torch.zeros((1, 64, 64, 3)), asset["url"], path)


NODE_CLASS_MAPPINGS = {"PopNowGenerate": PopNowGenerate}
NODE_DISPLAY_NAME_MAPPINGS = {"PopNowGenerate": "PopNow Generate"}

PopNow Generate 입력과 출력

model
모델 이름. 예: google/nano-banana-2.1/text-to-image. 각 모델의 API 페이지에 나와 있습니다.
prompt
만들 내용. 프롬프트가 필요 없는 모델이면 비워 두세요.
options
나머지 필드를 JSON으로. resolution, duration_seconds 등. 모든 필드는 모델의 API 페이지에 있습니다.
image
선택 IMAGE 입력. 자동으로 업로드되어 image_field로 지정한 필드에 들어갑니다.
image_field
이미지를 넣을 입력 필드. 대부분의 영상 모델은 image_url, 이미지 편집은 image_urls입니다.
image · url · path
이미지 모델은 IMAGE를, 영상과 오디오는 파일 URL과 로컬 경로도 함께 출력합니다.

ComfyUI에서 클라우드 모델을 쓰는 이유

  • GPU가 필요 없음

    24 GB 이상이 필요한 영상 모델도 저희 쪽에서 실행됩니다. 노트북은 프롬프트만 보냅니다.

  • 로컬 노드와 함께

    첫 프레임은 로컬에서 만들고, Kling이나 Seedance로 움직이게 한 뒤, 다시 로컬에서 업스케일하세요.

  • 실행당 가격이 분명함

    POST /jobs/quote로 실행 전에 예상 요금과 최대 요금을 미국 달러로 확인하세요. 작업이 실패하면 예약된 달러 금액이 해제되어 결제에 사용한 잔액으로 돌아갑니다.

처음 쓰기 좋은 모델

ComfyUI 질문

공식 패키지인가요?

네. popnow-comfyui는 PopNow가 직접 만든 노드 팩으로, Comfy Registry에 등록되어 있고 MIT 라이선스로 GitHub에 공개되어 있습니다. 이 페이지의 단일 파일은 그 안의 PopNow Generate 노드를 파일 하나로 만든 것이니 둘 중 하나만 설치하세요.

ComfyUI Desktop과 Comfy Cloud에서도 되나요?

커스텀 노드를 추가하고 환경 변수를 설정할 수 있는 곳이면 어디서든 됩니다. ComfyUI 포터블, Desktop, 자체 호스팅 서버에서 동작합니다.

영상 프레임은 어떻게 받나요?

노드가 영상을 ComfyUI output 폴더에 저장하고 경로를 돌려줍니다. 영상 불러오기 노드로 읽어 들이면 프레임 작업을 이어 갈 수 있습니다.

한 번 실행하는 데 얼마인가요?

실제 사용량에 따라 PopNow 잔액에서 미국 달러로 결제합니다. POST /jobs/quote로 실행 전에 예상 요금과 최대 요금을 미국 달러로 확인하세요. 실험하는 동안에는 콘솔에서 키에 일일 한도를 정해 두세요.