Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ history.
(`exact: true` for deployments, no `truncated` for releases), and the note
saying it can read low is left out. `note` is empty when nothing is left to say.

### Removed

- `comfy generate` drops five model aliases whose cloud routes are retired, so
every submit was already refused: `kling-extend` (Kling retired the V1.x
models the video-extend route accepts), `luma` and `luma-i2v` (Luma retired
its Ray video models and shut Photon down), and `moonvalley-t2v` /
`moonvalley-i2v` (Moonvalley exited and its `/proxy` routes were removed).
Typing one now returns the usual unknown-model error with suggestions rather
than failing at the proxy.

### Fixed

- The `comfy-build`, `comfy-build-pins`, `comfy-build-authoring` and
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ workflows, and call hosted partner image models, all from your terminal.
## Features

- 🚀 One-command ComfyUI install and launch
- 🎨 Direct calls to partner image and video nodes (Flux, Ideogram, DALL·E, Recraft, Reve, Gemini/nano-banana, Kling, Luma, Runway, Pika, Vidu, Hailuo, Seedance, …) via `comfy generate`, no workflow JSON required
- 🎨 Direct calls to partner image and video nodes (Flux, Ideogram, DALL·E, Recraft, Reve, Gemini/nano-banana, Kling, Runway, Pika, Vidu, Hailuo, Seedance, …) via `comfy generate`, no workflow JSON required
- 🔧 Custom node management — install, update, snapshot, bisect
- 📦 Fast dependency resolution with `uv` (`--fast-deps`, `--uv-compile`)
- 🗄️ Model downloads from CivitAI, Hugging Face, and direct URLs
Expand Down Expand Up @@ -492,7 +492,7 @@ local ComfyUI or workflow JSON required. It hits the same hosted partner nodes
you'd otherwise wire into a ComfyUI workflow, but as one-shot CLI calls. Image
models (Flux, Ideogram, DALL·E, Recraft, Runway, Reve, xAI Grok, Google
Gemini Flash Image aka **nano-banana**, …) and video models (Kling,
Luma, Runway Gen-3, Pika, Vidu, Moonvalley, Hailuo, Grok video, ByteDance
Runway Gen-3, Pika, Vidu, Hailuo, Grok video, ByteDance
**Seedance**) are all covered; video jobs run async and the CLI polls until
the result is ready.

Expand Down Expand Up @@ -532,9 +532,9 @@ with `comfy generate resume <model> <job_id>`. Examples:
comfy generate kling --prompt "a paper boat drifting on a river at dusk" \
--duration 5 --download boat.mp4

comfy generate luma --prompt "..." --aspect_ratio 16:9 --async
comfy generate vidu --prompt "..." --async
Comment thread
mattmillerai marked this conversation as resolved.
Resolved
# → prints job id; resume with:
comfy generate resume luma <job_id> --download out.mp4
comfy generate resume vidu <job_id> --download out.mp4
```

**Gemini Flash Image (nano-banana)** — text-to-image and image edits in one
Expand Down
16 changes: 0 additions & 16 deletions comfy_cli/command/generate/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,6 @@ class PollSpec:
success_values=("succeed",),
failure_values=("failed",),
),
"luma": PollSpec(
name="luma",
id_paths=("id",),
poll_url="/proxy/luma/generations/{id}",
status_paths=("state",),
success_values=("completed",),
failure_values=("failed",),
),
"minimax": PollSpec(
name="minimax",
id_paths=("task_id",),
Expand All @@ -218,14 +210,6 @@ class PollSpec:
failure_values=("FAILED", "CANCELLED", "THROTTLED"),
progress_path="progress",
),
"moonvalley": PollSpec(
name="moonvalley",
id_paths=("id",),
poll_url="/proxy/moonvalley/prompts/{id}",
status_paths=("status",),
success_values=("completed",),
failure_values=("failed", "error"),
),
"pika": PollSpec(
name="pika",
id_paths=("video_id", "id"),
Expand Down
100 changes: 83 additions & 17 deletions comfy_cli/command/generate/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Endpoint:
request_schema: dict[str, Any] # resolved (no $ref) request body schema
request_content_type: str # "application/json" | "multipart/form-data"
response_schema: dict[str, Any] # resolved 200 response schema
polling: str | None # "bfl" | "kling" | "luma" | "topaz" | None
polling: str | None # "bfl" | "kling" | "seedance" | None


# Short, creative-facing aliases mapping to the curated openapi paths below.
Expand Down Expand Up @@ -139,18 +139,11 @@ class Endpoint:
# Video — Kling
"kling": "kling/v1/videos/text2video",
"kling-i2v": "kling/v1/videos/image2video",
"kling-extend": "kling/v1/videos/video-extend",
"kling-lipsync": "kling/v1/videos/lip-sync",
# Video — Luma Dream Machine
"luma": "luma/generations",
"luma-i2v": "luma/generations/image",
# Video — MiniMax / Hailuo
"hailuo": "minimax/video_generation",
# Video — Runway Gen-3
"runway-i2v": "runway/image_to_video",
# Video — Moonvalley
"moonvalley-t2v": "moonvalley/prompts/text-to-video",
"moonvalley-i2v": "moonvalley/prompts/image-to-video",
# Video — Pika
"pika": "pika/generate/2.2/t2v",
"pika-i2v": "pika/generate/2.2/i2v",
Expand All @@ -168,6 +161,88 @@ class Endpoint:
}


# Router v2 id for each alias. None = proxy-only today: the operation has no
# Router id (non-JSON encoding, or an unbound model family). A value ending in
# "/{model}" is a family: the alias's model choice becomes the id suffix, and
# the second element is the default when no model is chosen. A plain id pins
# one model; `router_id` returns None for any other model choice.
# This table is data only — nothing in `comfy generate` consumes it yet; the
# Router client that will read it is separate work. Keep it exhaustive over
# `_ALIASES` (the test in test_spec.py enforces that).
_ROUTER_IDS: dict[str, tuple[str, str | None] | None] = {
"flux-pro": ("bfl/flux-pro-1.1", None),
"flux-ultra": ("bfl/flux-pro-1.1-ultra", None),
"flux-2": ("bfl/flux-2-pro", None),
"flux-kontext": ("bfl/flux-kontext-pro", None),
"flux-kontext-max": ("bfl/flux-kontext-max", None),
"flux-fill": ("bfl/flux-pro-1.0-fill", None),
"flux-expand": ("bfl/flux-pro-1.0-expand", None),
"ideogram": ("ideogram/ideogram-v3", None),
"ideogram-edit": None,
"ideogram-remix": None,
"ideogram-reframe": None,
"ideogram-bg": None,
"recraft": ("recraft/{model}", "recraftv3"),
"recraft-vectorize": None,
"recraft-upscale": None,
"recraft-upscale-creative": None,
"recraft-rmbg": None,
"recraft-replace-bg": None,
"recraft-i2i": None,
"recraft-inpaint": None,
"dalle": ("openai/{model}", "gpt-image-2.5-sunburst"),
Comment thread
mattmillerai marked this conversation as resolved.
Resolved
"dalle-edit": ("openai/{model}", "gpt-image-2.5-sunburst"), # same id; Router selects edits when `image` is present
"grok": ("xai/grok-imagine-image", None),
"grok-edit": ("xai/grok-imagine-image", None), # same id; `image`/`images` selects the edit
"reve": None,
"reve-edit": None,
"runway": ("runway/gen4_image", None),
"runway-i2v": ("runway/gen4_turbo", None),
Comment thread
mattmillerai marked this conversation as resolved.
Resolved
"kling": ("kling/{model}", "kling-v2-5-turbo"),
Comment thread
mattmillerai marked this conversation as resolved.
Resolved
"kling-i2v": ("kling/{model}", "kling-v2-5-turbo"), # same id; `image` selects image2video
"kling-lipsync": ("kling/videos-lip-sync", None),
"hailuo": None,
"pika": None,
"pika-i2v": None,
"vidu": None,
"vidu-i2v": None,
"vidu-extend": None,
"grok-video": ("xai/grok-imagine-video", None),
"nano-banana": ("vertexai/{model}", "gemini-2.5-flash-image"),
"seedance": ("byteplus/{model}", "seedance-1-0-pro-250528"),
Comment thread
mattmillerai marked this conversation as resolved.
Resolved
}


# One segment of a Router id: lowercase alphanumerics joined by `.`, `_` or `-`.
_ROUTER_SEGMENT_RE = _re.compile(r"^[a-z0-9]+(?:[._-][a-z0-9]+)*$")


def router_id(alias: str, model: str | None = None) -> str | None:
"""Router v2 id for an alias, or None when the alias is proxy-only.

For a family id (one whose template contains ``{model}``) the suffix is
``model`` when given, else the table's default. A non-family id pins one
model, so it is returned only when ``model`` is omitted or names that same
model; any other ``model`` has no Router id and gets None, rather than being
silently swapped for the pinned one. A resolved suffix that is not a valid
Router segment (empty, or carrying ``/``, ``..``, whitespace, uppercase, …)
also gets None. An alias absent from the table is treated as proxy-only
(None), so callers never raise on a stray key."""
entry = _ROUTER_IDS.get(alias)
if entry is None:
return None
template, default = entry
provider, _, pinned = template.partition("/")
if pinned == "{model}":
suffix = model or default
if not suffix or not _ROUTER_SEGMENT_RE.match(suffix):
return None
return f"{provider}/{suffix}"
if model is not None and model != pinned:
return None
return template


# Used in the `list` table for endpoints whose openapi summary is empty or too
# generic to convey what the model is.
_SUMMARY_OVERRIDES: dict[str, str] = {
Expand Down Expand Up @@ -244,18 +319,11 @@ def resolve_alias(target: str) -> str:
# Video — Kling
("kling/v1/videos/text2video", "text-to-video", "kling"),
("kling/v1/videos/image2video", "image-to-video", "kling"),
("kling/v1/videos/video-extend", "video-extend", "kling"),
("kling/v1/videos/lip-sync", "lipsync", "kling"),
# Video — Luma
("luma/generations", "text-to-video", "luma"),
("luma/generations/image", "image-to-video", "luma"),
# Video — MiniMax / Hailuo
("minimax/video_generation", "text-to-video", "minimax"),
# Video — Runway
("runway/image_to_video", "image-to-video", "runway"),
# Video — Moonvalley
("moonvalley/prompts/text-to-video", "text-to-video", "moonvalley"),
("moonvalley/prompts/image-to-video", "image-to-video", "moonvalley"),
# Video — Pika
("pika/generate/2.2/t2v", "text-to-video", "pika"),
("pika/generate/2.2/i2v", "image-to-video", "pika"),
Expand Down Expand Up @@ -497,8 +565,6 @@ def _detect_polling(partner: str, response_schema: dict[str, Any]) -> str | None
return "bfl"
if partner == "kling" and "data" in props:
return "kling"
if partner == "luma" and ("state" in props or "id" in props):
return "luma"
if partner == "topaz" and "process_id" in props:
return "topaz"
return None
Expand Down
2 changes: 1 addition & 1 deletion comfy_cli/schemas/generate_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"polling": {
"type": ["string", "null"],
"description": "Poller family driving the async result fetch (bfl, kling, luma, topaz), or null for sync models."
"description": "Poller family driving the async result fetch (e.g. bfl, kling, runway, seedance), or null for sync models."
},
"content_type": {
"type": "string",
Expand Down
30 changes: 1 addition & 29 deletions tests/comfy_cli/command/generate/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,34 +775,6 @@ def test_video_kling_async_path(runner, api_key, monkeypatch):
assert "https://cdn.example/k.mp4" in r.stdout


def test_video_luma_async_path(runner, api_key, monkeypatch):
submit = httpx.Response(200, json={"id": "luma-1", "state": "queued"})
done = httpx.Response(200, json={"id": "luma-1", "state": "completed", "assets": {"video": "https://cdn/l.mp4"}})
monkeypatch.setattr(gen_app.client.httpx, "post", lambda *a, **kw: submit)
monkeypatch.setattr("comfy_cli.command.generate.client.get", lambda *a, **kw: done)
monkeypatch.setattr("comfy_cli.command.generate.poll._sleep", lambda *_: None)

r = runner.invoke(
cli_app,
[
"generate",
"luma",
"--prompt",
"a cat",
"--aspect_ratio",
"16:9",
"--model",
"ray-2",
"--resolution",
"{}",
"--duration",
"{}",
],
)
assert r.exit_code == 0, r.stdout
assert "https://cdn/l.mp4" in r.stdout


def test_video_runway_failure_surfaces(runner, api_key, monkeypatch):
submit = httpx.Response(200, json={"id": "rw-1"})
fail = httpx.Response(200, json={"id": "rw-1", "status": "FAILED"})
Expand Down Expand Up @@ -861,7 +833,7 @@ def test_list_video_filter(runner):
r = runner.invoke(cli_app, ["generate", "list", "--style", "text-to-video"])
assert r.exit_code == 0
assert "kling" in r.stdout
assert "luma" in r.stdout
assert "seedance" in r.stdout
assert "pika" in r.stdout


Expand Down
72 changes: 72 additions & 0 deletions tests/comfy_cli/command/generate/test_spec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for the openapi registry — verify the curated image allowlist resolves
against the vendored spec and classifies each endpoint correctly."""

import re
from unittest import mock

import pytest
Expand Down Expand Up @@ -603,6 +604,77 @@ def test_find_property_descends_top_level_composition():
assert spec._find_property({"allOf": [{"type": "object"}]}, "model") is None


# ── dead aliases — retired on /proxy, removed from the alias table ──


@pytest.mark.parametrize("dead", ["kling-extend", "luma", "luma-i2v", "moonvalley-t2v", "moonvalley-i2v"])
def test_retired_aliases_removed(dead):
"""The five aliases dead on /proxy are gone from both tables, and typing
one yields the normal unknown-model error — not a silent skip."""
assert dead not in spec._ALIASES
endpoint_ids = {eid for eid, _cat, _poll in spec._ENDPOINT_ALLOWLIST}
assert spec.resolve_alias(dead) not in endpoint_ids
with pytest.raises(spec.SpecError) as excinfo:
spec.get_endpoint(dead)
assert "Unknown model" in str(excinfo.value)


# ── _ROUTER_IDS — the alias → Router v2 id table ──


def test_router_ids_exhaustive_over_aliases():
"""Every alias has a Router-id row and vice versa (40 rows after the
dead-alias removal)."""
assert set(spec._ROUTER_IDS) == set(spec._ALIASES)
assert len(spec._ROUTER_IDS) == 40


def test_router_ids_match_router_segment_pattern():
"""Every non-None id matches Router's segment pattern, with `{model}`
allowed in the model segment of a family id."""
pattern = re.compile(r"^[a-z0-9]+([._-][a-z0-9]+)*/[a-z0-9{}]+([._-][a-z0-9{}]+)*$")
for alias, entry in spec._ROUTER_IDS.items():
if entry is None:
continue
template, _default = entry
assert pattern.match(template), f"{alias}: {template!r} fails the Router segment pattern"


def test_router_id_resolves_families_and_proxy_only():
assert spec.router_id("recraft") == "recraft/recraftv3"
assert spec.router_id("recraft", "recraftv4_pro") == "recraft/recraftv4_pro"
assert spec.router_id("vidu") is None
# i2v shares the base alias's id — Router selects image2video from the payload.
assert spec.router_id("kling-i2v") == spec.router_id("kling")
# A plain (non-family) id pins one model: naming that model resolves to it,
# any other model has no Router id rather than being swapped for the pinned one.
assert spec.router_id("runway-i2v") == "runway/gen4_turbo"
assert spec.router_id("runway-i2v", "gen4_turbo") == "runway/gen4_turbo"
assert spec.router_id("runway-i2v", "gen3a_turbo") is None
assert spec.router_id("grok", "grok-imagine-image-pro") is None
assert spec.router_id("flux-pro", "anything") is None
# An alias not in the table is treated as proxy-only.
assert spec.router_id("not-an-alias") is None


@pytest.mark.parametrize("bad", ["../x", "a/b", "x?y", "x#y", "has space", "Upper", "trailing-"])
def test_router_id_rejects_malformed_family_model(bad):
"""A model choice that is not a valid Router segment never yields an id."""
assert spec.router_id("recraft", bad) is None


def test_router_id_defaults_resolve_to_valid_ids():
"""Every row resolves, with no model given, to an id matching the Router
segment pattern — the template test alone cannot catch a bad default."""
pattern = re.compile(r"^[a-z0-9]+([._-][a-z0-9]+)*/[a-z0-9]+([._-][a-z0-9]+)*$")
for alias, entry in spec._ROUTER_IDS.items():
if entry is None:
continue
resolved = spec.router_id(alias)
assert resolved is not None, f"{alias}: family row has no default"
assert pattern.match(resolved), f"{alias}: {resolved!r} fails the Router segment pattern"


# ── allowlist / alias drift against the bundled spec ──────────────────────


Expand Down
Loading
Loading