Comfy Router is not generally available yet.
POST /v2/models/{provider}/{model} and its catalog and schema siblings are not serving requests yet: an authenticated call answers 404 today. The snippets on this page document the contract those routes will serve, published ahead of the rollout so your integration is ready to write against.Quick start
Create a key at platform.comfy.org/profile/api-keys and export it asCOMFY_API_KEY. The Python and TypeScript snippets use the Comfy SDKs (pip install comfy-sdk, npm install @comfyorg/sdk); the cURL snippet is the same call over raw HTTP.
Model ID: vertexai/gemini-3.1-flash-image
Endpoint: POST https://api.comfy.org/v2/models/vertexai/gemini-3.1-flash-image
Schema
Input
Fields follow Google’s published API specification and are checked against it in CI. Router’s own schema for this model is not published yet, so requests are forwarded to the provider unvalidated.object[]
required
The conversation so far. For a single image, one
user turn with a text part; add an inlineData image part to edit an existing image.string
required
Who authored the turn.Possible values:
user, modelobject[]
required
The turn’s content parts.
string
A text part.
object
An inline media part.
string
Media type, for example
image/png.string
Base64-encoded media bytes.
object
Generation settings.
`TEXT`, `IMAGE`[]
Ask for an image with
["IMAGE"], or ["TEXT", "IMAGE"] to also get a caption.object
Image output settings.
string
Output aspect ratio, for example
1:1, 16:9, 9:16.integer
Seed for reproducible results.
object[]
Per-category harm thresholds.
string
Possible values:
HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_DANGEROUS_CONTENTstring
Possible values:
BLOCK_NONE, BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGHOutput
Router returns Google’s native response unchanged. The image (base64) is atcandidates[0].content.parts[0].inlineData.data.
object[]
Generated candidates; one unless you asked for more.
object
string
Possible values:
modelobject[]
object
The generated image, inline.
string
Media type of the image, typically
image/png.string
Base64-encoded image bytes. Decode and write to a file; there is no URL.
string
Present when
TEXT was among the requested modalities.string
Why generation stopped, for example
STOP.object
Token accounting for the call.
integer
Tokens in the prompt.
integer
Tokens in the generated candidates.
object
Present when the prompt itself was blocked. It is the only field returned in that case, so check for it before reading the result.
string
Why the prompt was blocked. No candidates are returned; rephrase the prompt and retry.Possible values:
SAFETY, OTHER, BLOCKLIST, PROHIBITED_CONTENT, IMAGE_SAFETYExamples
Input
Output
inlineData.data, with its mimeType beside it. Decode it and write it to a file; there is no URL to download.
Before you ship
The snippets above are the shortest working call. Three things are the same for every model and are documented once on the Comfy Router headers page: send anIdempotency-Key on every paid call and reuse it when you retry, expect the connection to be held up to Router’s 10 minute deadline, and keep X-Comfy-Request-Id from every response. The SDKs do all three for you; the cURL tab does none of them. On failure, X-Comfy-Error-Type names the bucket, and a 422 means the body failed the model’s schema and was never billed.
Headers
Authentication, idempotency, request IDs, error buckets, retry pacing, spend limits.
Quickstart
Typed error handling in Python and TypeScript, reading the 422, walking the catalog.
Limitations
What Router does not do today, and what to use instead.