Hi, I have an issue when running a ComfyUI workflow through the API from a Python script.
My workflow contains API Nodes (BRIA). When I run the workflow manually from the ComfyUI web interface everything works correctly.
However, when I trigger the same workflow via the ComfyUI API (/prompt) from Python, the job fails immediately and the UI shows the popup:
“Sign In Required to Use API Nodes”
The workflow starts processing but stops during the preprocessing stage.
Example console output from my Python script:
Input folder of photos: C:\_\_\_\_\car_test
Found 4 images.
Outputs root: C: :\_\_\_\_\car_test_processed
Processing: 1.JPG
Uploaded image name: a731sad.jpg
Submitted prompt_id: a2313-4c.....
Job status: preprocessing (elapsed: 0s)
Then the job fails because the UI asks for login.
Important details:
-
I am already logged in to the web UI in my browser.
-
The workflow runs correctly when executed manually from the UI.
-
The issue only happens when triggering the workflow via Python API.
-
It looks like the API Nodes require a browser session login, which is not available when running the workflow programmatically.
Questions:
-
Is there a way to authenticate API Nodes when running workflows through the ComfyUI API?
-
Is there a recommended way to run workflows with API Nodes in automated batch scripts?
My goal is to run batch processing from Python on a folder of images without needing manual login through the UI.
Any help would be appreciated.
I hit this exact same wall (in my case with the Grok partner nodes, running against Comfy Cloud) and found the supported solution, so leaving it here for anyone who lands on this thread.
Root cause: API/Partner nodes don’t authenticate with your server session or the header API key — they authenticate against your Comfy account. When you queue a prompt programmatically via POST /prompt, that account credential ils with “Sign In Required to Use API Nodes” (or “Unauthorized: Please login first to use this node”) even though the same workflow runs fine from the browser.
The fix: ComfyUI supports passing an account API key inside the prompt payload since PR #8041 ( Add support for Comfy API keys by christian-byrne · Pull Request #8041 · Comfy-Org/ComfyUI · GitHub ). Steps:
- Create an API key for your Comfy account at platformcomfyorg (this is a different key from any other key you may already be using — it’s tied to the
account that holds your API-node credits).
- Include it in the extra_data field of every /prompt request:
import requests
payload = {
"prompt": workflow, # your API-format workflow dict
"extra_data": {
"api_key_comfy_org": "comfyui-xxxxxxxx..." # key from platform.comfy.org
},
}
requests.post("http://127.0.0.1:8188/prompt", json=payload)
That’s the whole change — no browser session, no cookies, works full. Official docs: ComfyUI Account API Key Integration - ComfyUI
Two caveats:
- The account behind the key needs enough credits, since that’s what the partner nodes bill against.
- Treat the key as a secret (env var, not hardcoded) — anyone holding it can spend your credits.
For what it’s worth, I can confirm this also works against Comfy Cllongside the regular X-API-Key header used for queueing): a Grokpartner-node workflow that had been failing with the login error for weeks ran end-to-end on the first try after adding extra_data.api_key_comfy_org.