Home/ COMFYUI/ Comfy Router API Tutorial: Setup, Routing & Cost Comparison
COMFYUI

Comfy Router API Tutorial: Setup, Routing & Cost Comparison

Set up Comfy Router with a documented Python example, understand provider routing, and compare hosted API costs with local GPU execution.

Published Oct 19, 2026 · 3 min read
Conceptual API gateway connecting to image, video and audio outputs

Checked October 18, 2026. Comfy Router provides a shared API for hosted image, video, audio, and 3D models. Comfy announced it on September 23. This guide explains the integration and a cost-comparison method; The Signal has not executed paid API requests or measured provider performance.

Router, Cloud, and local ComfyUI serve different jobs

Router calls hosted models. Comfy Cloud provides a hosted workflow editor. Local ComfyUI executes compatible models on hardware you manage. Access to a hosted model does not imply downloadable weights or permission to self-host it. For the broader trade-offs, read Comfy Cloud vs local GPU.

Prepare your first API call

  1. Sign in to the Comfy Developer Platform and create an API key.
  2. Check the selected model’s current catalog price and input schema. Add only the credit balance needed for a small test.
  3. Follow the installation instructions for the official Python SDK through the developer documentation. Keep the package version in your project dependency file.
  4. Store your key in the server-side COMFY_API_KEY environment variable. Do not put it in browser code or a public repository.
  5. Run this adapted example only after reviewing its billable model choice.
import os
from comfy_sdk import Comfy

client = Comfy(api_key=os.environ["COMFY_API_KEY"])
result = client.models.run(
    "openai/gpt-image-2",
    {"prompt": "Studio photograph of an unbranded ceramic cup on linen"},
)
print(result)

The SDK call shape and model identifier follow the official Router example. The prompt and environment-variable handling are editorial adaptations. No output shown here is a claimed test result.

Choose a provider deliberately

The product page documents provider selection through model_provider. Check supported routes and the exact SDK signature before adding it. Do not assume automatic cheapest-provider selection or failover: these are not launch defaults. An unavailable chosen provider can produce a failure without substitution.

Compare cost per usable output

Router uses credits without requiring a subscription. Prices vary by model and settings; there is no single Router-versus-local rate. Use the catalog quote, then record actual charges.

RouteInclude in your calculation
Hosted APIAll charged attempts, storage, transfer, integration time
Rented GPURuntime, idle time, downloads, storage, maintenance
Owned GPUHardware allocation, electricity, maintenance, opportunity cost

Cost per accepted output = total attributable cost / accepted outputs. For a hypothetical $12 experiment yielding 40 acceptable images, that is $0.30 per accepted image. These are illustrative numbers, not Comfy prices. A proprietary hosted model and a different local model are a task-level comparison, not an identical-model benchmark.

A small validation plan

Start with one job. Check the returned result and download the output. Then compare routes on the same brief, output size, and acceptance rubric. Record failures, charges, and end-to-end latency separately. Avoid blind retries when a timed-out job may already have run. For an automated pipeline, see our ComfyUI automation guide.

Sources

The Signal newsletter

Keep getting this

One edition a week on open models, local setups and the tools around them.

Read the latest issue

Email delivery opens once the newsletter platform is connected.