From fd41506b7553bea2e08c82349ac05f83e610993d Mon Sep 17 00:00:00 2001 From: Hunter Senft-Grupp Date: Sun, 31 May 2026 13:31:04 -0400 Subject: [PATCH 1/2] feat: expose comfy-api/platform base URLs via /features Adds --comfy-platform-base CLI flag mirroring --comfy-api-base, and surfaces both through the existing /features endpoint as comfy_api_base_url and comfy_platform_base_url. Lets the frontend discover at runtime which backend the local server expects it to talk to, so an ephemeral or self-hosted comfy-api deployment can be wired up without rebuilding the frontend bundle. Companion frontend change consumes these keys. --- comfy/cli_args.py | 7 +++++++ comfy_api/feature_flags.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index a4cabcc65..81432ccd2 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -231,6 +231,13 @@ parser.add_argument( help="Set the base URL for the ComfyUI API. (default: https://api.comfy.org)", ) +parser.add_argument( + "--comfy-platform-base", + type=str, + default="https://platform.comfy.org", + help="Set the base URL for the ComfyUI Platform. (default: https://platform.comfy.org)", +) + database_default_path = os.path.abspath( os.path.join(os.path.dirname(__file__), "..", "user", "comfyui.db") ) diff --git a/comfy_api/feature_flags.py b/comfy_api/feature_flags.py index adb5a3144..6d9dc75d0 100644 --- a/comfy_api/feature_flags.py +++ b/comfy_api/feature_flags.py @@ -99,6 +99,8 @@ _CORE_FEATURE_FLAGS: dict[str, Any] = { "extension": {"manager": {"supports_v4": True}}, "node_replacements": True, "assets": args.enable_assets, + "comfy_api_base_url": args.comfy_api_base, + "comfy_platform_base_url": args.comfy_platform_base, } # CLI-provided flags cannot overwrite core flags From 8d7087a7a9b8768cd53e85593f9c033b53a2a7ec Mon Sep 17 00:00:00 2001 From: Hunter Senft-Grupp Date: Sun, 31 May 2026 13:45:07 -0400 Subject: [PATCH 2/2] test: assert comfy_api_base_url + comfy_platform_base_url are exposed via /features --- tests-unit/feature_flags_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests-unit/feature_flags_test.py b/tests-unit/feature_flags_test.py index 8ec52a124..bc5aac01c 100644 --- a/tests-unit/feature_flags_test.py +++ b/tests-unit/feature_flags_test.py @@ -32,6 +32,17 @@ class TestFeatureFlags: assert "max_upload_size" in features assert isinstance(features["max_upload_size"], (int, float)) + def test_get_server_features_exposes_comfy_api_base_urls(self): + """The frontend reads comfy_api_base_url / comfy_platform_base_url + from /features to learn which backend to talk to. The keys must be + present (with the CLI-provided or default URL) so an ephemeral or + self-hosted comfy-api can override them without a frontend rebuild.""" + features = get_server_features() + assert isinstance(features.get("comfy_api_base_url"), str) + assert features["comfy_api_base_url"].startswith("http") + assert isinstance(features.get("comfy_platform_base_url"), str) + assert features["comfy_platform_base_url"].startswith("http") + def test_get_connection_feature_with_missing_sid(self): """Test getting feature for non-existent session ID.""" sockets_metadata = {}