OpenAI/Azure OpenAI Image API with gpt-image-1
Run gpt-image-1 from inside ComfyUI without running it
- image
- IMAGE
This node is a bridge, not a model. It takes a prompt (and optionally an image from your ComfyUI graph), ships it to OpenAI's gpt-image-1 - the model behind the 4o image generation that went viral with those Ghibli portraits - and hands the finished image back as a normal ComfyUI tensor. You don't download weights, you don't need a big GPU, and you can't run it locally at all: it's a closed, hosted model. You pay per image instead. For text rendering and serious image editing, gpt-image-1 is genuinely in a different league from what most local models do, so this is the node you reach for when your prompt is heavy on legible words, logos, or "change this photo" edits.
It's the sole node in the pack, and the pack itself is a fork - Jiajun Chen's (cjj198909) fork of unicough/comfy_openai_image_api with Azure OpenAI support bolted on. One honest caveat before you get invested: ComfyUI's own official API Nodes added gpt-image-1 support in beta back in April 2025. If you only need plain OpenAI, that's arguably the more maintained path. Where this pack earns its keep is the Azure branch and the dead-simple, single-node setup.
How it works
The node picks its path by what you feed it. No image input → it calls client.images.generate. Give it an image (or several) → it calls client.images.edit, which is the interesting one: gpt-image-1's edit endpoint merges up to four input images into one output, so you can composite reference shots right in the node. Under the hood it converts your tensor to base64 for the request, then decodes result.data[0].b64_json back into a single IMAGE output - so whatever else is in the graph, this node's downstream is a normal image. Wire the IMAGE output into a Preview Image or Save Image node and you're done.
Credentials work two ways. For OpenAI, an api_key on the node or an OPENAI_API_KEY environment variable. For Azure, the node fields (azure_endpoint, azure_api_version, azure_deployment) or their AZURE_OPENAI_* env equivalents, with the node values winning. It also calls load_dotenv() on startup, so a .env file in the pack directory works. Env vars are the right call - keys pasted into a saved workflow end up in your JSON.
The inputs that actually matter
- prompt - multiline, defaults to "A beautiful image". Your actual instruction; for edits, be specific ("add a sunset sky", "make it Studio Ghibli style").
- provider -
openaiorazure. This is the fork's whole reason to exist. - size -
1024x1024,1536x1024,1024x1536. Three options, that's it. - quality -
low/medium/high. This is your price dial; more below. - image (optional) - the IMAGE input that switches generation to editing.
model is fixed to gpt-image-1, and azure_api_version defaults to 2025-04-01-preview - leave that alone unless your Azure resource needs something newer.
Installing it
From ComfyUI Manager, search "OpenAI/Azure OpenAI Image API". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cjj198909/comfy_openai_image_api_azure
cd comfy_openai_image_api_azure
pip install -r requirements.txt
Then restart ComfyUI. No model files download, and the dependency list is refreshingly light - openai, python-dotenv, pillow, numpy, with torch coming from your existing ComfyUI install. The Azure SDK ships inside the openai package these days, so there's no separate Azure dependency to chase.
Where people get burned
- The cost. This is a metered API. High quality runs about a quarter a shot; low and medium are closer to pennies. Great for one-off hero images, painful if you're iterating a prompt forty times - iterate at low quality, and grab the actual rates before you build a whole batch workflow around it.
- Missing or malformed credentials. The classic errors: "Azure OpenAI API key is required" (provider set to azure, no key anywhere) and Azure's "Request URL is missing an 'http://' or 'https://' protocol" - the endpoint needs the full
https://your-resource.openai.azure.com/form, trailing slash included. - Wrong deployment name. For Azure,
azure_deploymentmust exactly match the name you gave the gpt-image-1 deployment in your resource - it's notgpt-image-1by magic. - Guardrails. This is a hosted, heavily moderated model - the KB's history on OpenAI image gen is one long story of censorship toggles. If a prompt trips a filter you'll get an error, and no amount of retrying fixes it.
- Rate limits and timeouts. The client is set to retry up to 3 times with a 60-second timeout, but heavy concurrent queues can still hit 429s. Space out a batch rather than blasting it.
If it's not showing up in the node list after install, check the ComfyUI console for an import error - usually a missing dependency from a skipped pip install.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | A beautiful image | — |
| model | COMBO | 1 options: gpt-image-1 | |
| size | COMBO | 3 options: 1024x1024, 1536x1024, 1024x1536 | |
| quality | COMBO | 3 options: low, medium, high | |
| provider | COMBO | 2 options: openai, azure | |
| imageopt | IMAGE | — | |
| api_keyopt | STRING | — | |
| azure_endpointopt | STRING | — | |
| azure_api_versionopt | STRING | 2025-04-01-preview | — |
| azure_deploymentopt | STRING | gpt-image-1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |