The CLI supports two authentication paths: an interactive device-code OAuth flow for humans, and a token env var for CI / containers. Both produce the same kind of token: a row in theDocumentation Index
Fetch the complete documentation index at: https://docs.runcomfy.com/llms.txt
Use this file to discover all available pages before exploring further.
user_tokens table tied to your RunComfy account, sent as Authorization: Bearer <token> to the Model API and other RunComfy services.
Device-code flow (runcomfy login)
The everyday path for human users. Standard OAuth 2.0 device authorization grant — same shape as gh auth login or stripe login.
- Calls
POST https://www.runcomfy.com/api/cli-auth/startand receives a shortuser_code(e.g.ABCD-1234). - Prints the code prominently in your terminal.
- Opens
https://www.runcomfy.com/cli-authin your browser. - Polls
POST .../cli-auth/pollevery two seconds.
- Sign in (magic link or any other configured provider).
- Type or paste the code from the terminal into the form. The page deliberately doesn’t accept a
?code=…query string, so a stranger can’t send you a pre-filled link to phish your token. - Click Authorize.
~/.config/runcomfy/token.json (Unix mode 0600).
runcomfy login (token_type='cli' in user_tokens) and can be revoked independently of any other API tokens you have on your Profile page.
CI / container env var (RUNCOMFY_TOKEN)
In a non-interactive environment, set RUNCOMFY_TOKEN to bypass the device-code flow entirely:
~/.config/runcomfy/token.json. Get the token from your Profile page (the “API Token” section) — that token is interchangeable with one minted by runcomfy login, just with a different token_type.
For GitHub Actions:
Where the token lives
| Source | Location | When used |
|---|---|---|
RUNCOMFY_TOKEN env var | n/a | Always wins if set |
runcomfy login | $XDG_CONFIG_HOME/runcomfy/token.json or ~/.config/runcomfy/token.json | Default location on Linux/macOS/Windows |
| Override | RUNCOMFY_CONFIG_DIR=<path> | Useful for tests / sandboxes |
| Legacy macOS | ~/Library/Application Support/runcomfy/token.json | Read-only fallback for older builds |
mode 0600 (only your user can read), and runcomfy login writes it atomically (temp file + rename(2)) so a crash mid-write can’t corrupt it.
Revoking a token
- Local logout:
runcomfy logoutremoves the token file. The token is still valid server-side until you also revoke it. - Server-side revoke: rotate or delete the row from your Profile page.
Security notes
- The token is plaintext in
user_tokens.tokenserver-side. (Token-at-rest hashing is on the roadmap but does not change CLI behavior.) - Don’t commit
token.jsonor echo$RUNCOMFY_TOKENin CI logs. - The CLI never logs the token:
runcomfy -v ...andRUST_LOG=reqwest=trace ...redact theAuthorizationheader. - If you suspect a token leak: rotate immediately on the Profile page, then
runcomfy logout && runcomfy login.
