Skip to content

feat(server): expose comfy_api_base in /api/system_stats response#13571

Open
snomiao wants to merge 1 commit intoComfy-Org:masterfrom
snomiao:feat/expose-comfy-api-base-in-system-stats
Open

feat(server): expose comfy_api_base in /api/system_stats response#13571
snomiao wants to merge 1 commit intoComfy-Org:masterfrom
snomiao:feat/expose-comfy-api-base-in-system-stats

Conversation

@snomiao
Copy link
Copy Markdown
Member

@snomiao snomiao commented Apr 26, 2026

Problem

The static preview frontend (and other thin clients) need to know which cloud environment a ComfyUI instance is configured for. Currently the only way to determine this is to parse the raw argv array from /api/system_stats and look for --comfy-api-base. This is fragile and doesn't handle the default case cleanly.

Solution

Add comfy_api_base directly to system.system_stats response. The value comes from args.comfy_api_base, which already defaults to https://api.comfy.org when the flag is not specified.

 "system": {
   ...
   "argv": sys.argv,
+  "comfy_api_base": args.comfy_api_base
 }

Before

{ "system": { "argv": ["main.py", "--comfy-api-base", "https://api.comfy.org", ...] } }

Clients had to scan argv for the flag, handle both --flag value and --flag=value forms, and guess the default when the flag was absent.

After

{ "system": { "argv": [...], "comfy_api_base": "https://api.comfy.org" } }

Clients read a single field. Default is always explicit.

Companion frontend PR

Comfy-Org/ComfyUI_frontend#11118 — the preview frontend will consume comfy_api_base directly when present, with argv parsing as a fallback for older backends.

Testing

No behavioural change for existing installs — the field just becomes visible. Can be verified by curling a running instance:

curl -s http://localhost:8188/api/system_stats | python3 -m json.tool | grep comfy_api_base

Expected: "comfy_api_base": "https://api.comfy.org" (or the value passed via --comfy-api-base).

Copilot AI review requested due to automatic review settings April 26, 2026 22:28
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7b070151-6365-49d2-8596-53c2a6356957

📥 Commits

Reviewing files that changed from the base of the PR and between fb65176 and 06adf92.

📒 Files selected for processing (1)
  • server.py
✅ Files skipped from review due to trivial changes (1)
  • server.py

📝 Walkthrough

Walkthrough

The /system_stats JSON response’s system object now includes a new comfy_api_base field populated from args.comfy_api_base. Existing runtime details (argv, OS, memory, Python and PyTorch versions, device stats) remain unchanged. No public function or type signatures were modified; the change is limited to the endpoint’s internal response structure. The change set shows 2 additions and 1 deletion in server.py.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: exposing comfy_api_base in the /api/system_stats response, which matches the PR's primary objective.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem solved, the solution implemented, testing instructions, and a companion frontend PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes the configured Comfy API base URL directly in the /api/system_stats (and legacy /system_stats) response so thin clients can reliably detect the cloud environment without parsing argv.

Changes:

  • Add system.comfy_api_base to the system stats JSON payload, sourced from args.comfy_api_base (already defaulting to https://api.comfy.org).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@snomiao snomiao requested a review from christian-byrne April 26, 2026 22:47
snomiao added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 26, 2026
- Add prPreviewBadges extension (active only when CI_PR_NUMBER is set):
  - Topbar warning badge showing "PR #XXXX", tooltip with author/commit/backend URL
  - About panel badges: clickable PR#, author (@handle), commit hash links
- Declare __CI_PR_NUMBER__, __CI_PR_AUTHOR__, __CI_BRANCH__, __CI_RUN_ID__,
  __CI_JOB_ID__, __COMFYUI_FRONTEND_COMMIT__ as global TS constants in vite-env.d.ts
- Extract resolveBackendCloudBase() to shared util at
  src/platform/connectionPanel/resolveBackendCloudBase.ts
- Add comfy_api_base as optional field in zSystemStats schema (companion to
  backend PR Comfy-Org/ComfyUI#13571)
- Add prPreview i18n keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
snomiao added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Apr 27, 2026
- Add prPreviewBadges extension (active only when CI_PR_NUMBER is set):
  - Topbar warning badge showing "PR #XXXX", tooltip with author/commit/backend URL
  - About panel badges: clickable PR#, author (@handle), commit hash links
- Declare __CI_PR_NUMBER__, __CI_PR_AUTHOR__, __CI_BRANCH__, __CI_RUN_ID__,
  __CI_JOB_ID__, __COMFYUI_FRONTEND_COMMIT__ as global TS constants in vite-env.d.ts
- Extract resolveBackendCloudBase() to shared util at
  src/platform/connectionPanel/resolveBackendCloudBase.ts
- Add comfy_api_base as optional field in zSystemStats schema (companion to
  backend PR Comfy-Org/ComfyUI#13571)
- Add prPreview i18n keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@snomiao snomiao requested a review from bigcat88 April 28, 2026 18:33
Add system.comfy_api_base to /api/system_stats so clients (especially
the static preview frontend) can read the configured cloud API base
URL directly instead of parsing it out of argv.

The value is always present: it defaults to https://api.comfy.org
when --comfy-api-base is not specified, matching the existing default
in cli_args.py.
@snomiao snomiao force-pushed the feat/expose-comfy-api-base-in-system-stats branch from fb65176 to 06adf92 Compare April 30, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants