Skip to main content
API Reference for Flux.1 Kontext. Flux.1 Kontext is Black Forest Labs’ instruction-driven image editing model: send an image and a text instruction, get the edited image back with the rest of the scene preserved.
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: bfl/flux-kontext-proEndpoint: POST https://api.comfy.org/v2/models/bfl/flux-kontext-pro

Schema

Input

Fields follow Black Forest Labs’ 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.
string
required
What to change in the image. Describe the edit, not the whole scene.
string
The image to edit, base64 encoded or an HTTPS URL. Optional in the schema, but Kontext is an editing model: without it you get text-to-image.
string
Output aspect ratio, from 21:9 to 9:21.
integer
Seed for reproducible results. Omit for random.
boolean
default:"false"
Rewrite the prompt for richer results. Results are not reproducible when enabled.
integer
default:"2"
Moderation tolerance for inputs and outputs. 0 is strictest.Range: 0 to 6
string
default:"\"png\""
Format of the returned image.Possible values: jpeg, png, webp
string
Additional reference image (base64 or HTTPS URL). Experimental multi-reference input.
string
Additional reference image (base64 or HTTPS URL). Experimental multi-reference input.
string
Additional reference image (base64 or HTTPS URL). Experimental multi-reference input.

Output

Router returns Black Forest Labs’ native response unchanged. The image is at result.sample.
string
required
BFL task id for this generation.
string
required
Terminal task status. Router only returns once this is Ready.Possible values: Ready
object
required
string (uri)
required
Signed URL of the generated image. Temporary: download it promptly.Format: uri
string
The prompt that was run, after any upsampling.
integer
Seed used for this generation.

Examples

Input

Output

The URL is temporary. Download the image promptly if you need to keep it.

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.