Skip to main content
Every Router model uses POST /v2/models/{provider}/{model} with its own JSON body. This page covers the headers shared across models; the API reference lists the generated contract. The Comfy SDKs (comfy-sdk for Python, @comfyorg/sdk for TypeScript) handle authentication and generate idempotency keys. They expose selected response metadata as described below. Raw HTTP clients must send and read the headers themselves.

Request headers

string
A Comfy API key, comfyui-..., created at platform.comfy.org/profile/api-keys. It uses your workspace’s model access and credit balance. You can also send it as Authorization: Bearer comfyui-...; if both headers are present, X-API-Key wins.
string
Bearer <token>. A comfyui- value is an API key. Any other value is treated as a Comfy Cloud JWT.
string
Identifies one logical generation. Generate and store a UUID before the call, then reuse it for retries of the unchanged request. The key can replay a result or collect accepted work for up to 24 hours. The SDKs generate keys and let you supply your own (idempotency_key= in Python, idempotencyKey in TypeScript). See retry outcomes for conflicts, expiry, and non-replayable results.
string
application/json. Send the model’s native JSON input. Fields and validation requirements vary by model; see Using the Router API.
string
On GET /v2/models/{provider}/{model}/openapi.json only. Send the ETag you hold from an earlier 200; when it still matches, the answer is a bodyless 304 with the same ETag. Cache a model’s schema for the life of your process and revalidate it this way rather than re-reading it before every call.

Response headers

string
required
Identifies this HTTP request. Include it when contacting support. TypeScript exposes it as requestId; Python exposes request_id on errors.
string
The machine-readable error category. On a 422, use this header because the validation body has detail[] and no error_type. Combine it with the HTTP status to decide what to do. Treat an unknown value as internal_error for control flow and preserve it for diagnostics.
boolean
Present and true when Router serves a stored result instead of running the model again. It is absent on a fresh run.
integer
Seconds to wait before retrying. On 409 / concurrency_limit_exceeded or 504 / deadline_exceeded, retry the same request and key after the wait. On 429 / rate_limited, it tells you when the rate limit resets.
integer
The ceiling on partner spend committed to calls still running, in USD cents. An enforcing spend gate can return it on admitted responses and on its 429 refusals. It is absent when the gate is not enforcing or a different control refused the request.
integer
USD cents currently committed to calls in flight. An admitted response includes its own call; a 429 excludes the refused call. Sent alongside X-Committed-Spend-Limit.
integer
USD cents left below the committed-spend ceiling. It can be positive on a refusal when the requested call costs more than the remaining amount.
string
On GET /v2/models/{provider}/{model}/openapi.json. Store it and send it back as If-None-Match to revalidate a cached schema.
string
On the schema route: private, must-revalidate. Keep the response in a private cache and revalidate stale copies with the ETag.

Status codes that carry two meanings

Three statuses are shared by two buckets, and the header is what tells them apart:

Next