https://api.comfy.org with one Comfy API key. Send the model’s input to POST /v2/models/{provider}/{model} and wait for the finished result. This example generates an image with bfl/flux-2-pro.
1
Create an API key
Create a key in your Comfy workspace. In a Bash-compatible terminal, set:Keep API keys on your server or in your local environment. These examples are for a terminal or server, not browser JavaScript.
2
Save a key for this request
Generate this value once for this image. If you retry the same request, reuse it.If
uuidgen is unavailable, use another UUID generator. Use a new key when you start a new image.3
Generate an image
Choose your language and run the example. Image generation can take a few minutes.Both SDKs read
COMFY_API_KEY from the environment.4
Read and save the result
For this model, the image URL is at Open the returned URL or download it:Download promptly. Router can rehost BFL assets on Comfy storage, but URLs expire and a replay does not renew them. A failed rehost can leave a shorter-lived provider URL. See result assets.
result.sample in the response body. An abbreviated response looks like this; the URL below is illustrative:Next steps
Get an API key
Create and manage the Comfy API key used in this quickstart.
Explore models
Browse the latest models, inspect their inputs, and swap the model ID in this example.