Skip to main content
API Reference for Google Gemini. Google Gemini is Google’s family of multimodal text models, covering fast drafting through deep reasoning across the Flash and Pro tiers.
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 as COMFY_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. Pick the model you want to call. The models share one request and response shape, documented once below.
Model ID: vertexai/gemini-3.1-pro-previewEndpoint: POST https://api.comfy.org/v2/models/vertexai/gemini-3.1-pro-preview

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, oldest first. A part is text, or inlineData to send an image, audio or video alongside the prompt.
string
required
Who authored the turn.Possible values: user, model
object[]
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
System prompt applied to the whole conversation.
object[]
string
object
Sampling and length settings.
number
Randomness of sampling. Defaults are model specific.Range: 0 to 2
number
Nucleus sampling threshold. Defaults are model specific.
integer
Top-k sampling cutoff. Defaults are model specific.
integer
Upper bound on generated tokens.
integer
Seed for reproducible sampling.
string[]
Strings that end generation when produced.
object
Reasoning effort controls on models that support it.
string
Possible values: MINIMAL, LOW, MEDIUM, HIGH
boolean
Return the model’s reasoning alongside the answer.
object[]
Function declarations the model may call.
object[]
string
string
object
JSON Schema for the function’s arguments.

Output

Router returns Google’s native response unchanged. The text is at candidates[0].content.parts[0].text.
object[]
Generated candidates; one unless you asked for more.
object
string
Possible values: model
object[]
string
The generated text.
object
Present when the model chose to call one of your tools.
string
object
string
Why generation stopped: STOP, MAX_TOKENS, SAFETY, …
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_SAFETY

Examples

Input

Output

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 an Idempotency-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.