Skip to main content
The CLI exposes six commands. All accept the global flags --output {pretty,json}, -q/--quiet, -v/--verbose, and all except login / logout require authentication (Authentication). Aliases: runcomfy requests getruncomfy status, runcomfy requests cancelruncomfy cancel. For exit-code semantics across all commands, see Troubleshooting → Exit codes.

login

Authenticate the CLI with RunComfy via the device-code OAuth flow.
  1. Calls POST {web_base}/api/cli-auth/start, receives a short user code and a verification URL.
  2. Prints the code in the terminal:
  3. Opens the verification URL in your default browser.
  4. Polls POST {web_base}/api/cli-auth/poll every 2 seconds.
  5. On Authorize, saves the access token to ~/.config/runcomfy/token.json (mode 0600).
  6. Ctrl-C aborts the wait cleanly.
In CI or any non-interactive environment, set RUNCOMFY_TOKEN=<token> and skip runcomfy login entirely.

logout

Removes the local token file. Does not revoke the token server-side — for that, rotate it on your Profile page.

whoami

Show the currently authenticated user.
In --output json mode the same data goes to stdout as a single line, useful for scripts:
Backs GET https://www.runcomfy.com/api/auth/me.

run

Run a Model API model end-to-end: submit, poll, fetch the result, download generated files.
<model_id> is the slash-separated identifier from the Models catalog (e.g. blackforestlabs/flux-1-kontext/pro/edit, openai/gpt-image-2/text-to-image).

Examples

End-to-end output

Stdout receives the result JSON; stderr receives the progress lines (or [tag] text if not a TTY / NO_COLOR is set).

Behavior details

  • Submit: POST https://model-api.runcomfy.net/v1/models/<model_id> with the JSON body as-is (Model API expects flat input, not {"input":{...}}).
  • Poll: GET .../requests/<id>/status every --poll-secs seconds.
  • Fetch: on terminal status (completed / succeeded / failed / cancelled), GET .../requests/<id>/result.
  • Download whitelist: the CLI scans the result JSON recursively and downloads every URL whose host ends with .runcomfy.net or .runcomfy.com. URLs outside that whitelist are listed but not fetched — preventing a compromised upstream model from coercing the CLI into pulling arbitrary internet content. Downloads stream to disk and abort with unlink(2) if the response exceeds 2 GiB.
  • Ctrl-C: while polling, sends POST .../requests/<id>/cancel to RunComfy before exiting. If the cancel call itself fails, the CLI prints the request_id and tells you to retry with runcomfy cancel <id> — so you don’t get billed for GPU you thought was stopped.

status

Poll the status of a Model API request submitted via runcomfy run --no-wait.
If still queued, the output also includes queue: position N. The CLI doesn’t loop — it returns the current snapshot and exits. Wrap in your own while loop for repeated checks. Backs GET .../requests/<id>/status.

cancel

Cancel a queued or running Model API request.
If already terminal:
In --output json mode, the response includes an outcome field (cancelled or not_cancellable). runcomfy run (without --no-wait) auto-cancels on Ctrl-C, so you only need cancel directly when you submitted with --no-wait, the auto-cancel failed, or you’re cancelling someone else’s request_id. Backs POST .../requests/<id>/cancel (returns 202 Accepted).