GPT Image 2 — Estimate Cost
Know what a GPT Image 2 render costs before you pay for it
- text_tokens
- image_in_tokens
- image_out_tokens
- usd_cost
- summary
The best node in this pack is the one that never makes an image. GPT Image 2 - Estimate Cost is a dry-run calculator: you feed it the same prompt, size, quality and count you'd send to Generate or Edit, and it tells you the projected token count and dollar cost. No API key, no network call, no surprises on the bill.
This matters more than it sounds. The loudest objection to API nodes in the ComfyUI community is never the quality - it's that per-call metering "adds up faster than people expect," and the official response is basically "yes, that's the real price of these renders." A node that shows you the price before you hit run is the grown-up answer to that argument. The other option is learning the hard way when a batch of 4K edits lands on your statement.
How it works
Open the source and it's refreshingly honest math. Pricing is hard-coded from OpenAI's published rates - for gpt-image-2, text in at $5/M tokens, image input at $8/M ($2/M if cached), image output at $30/M - with legacy tables for gpt-image-1.5, gpt-image-1, and gpt-image-1-mini (cheaper, down to $16/M output). Text tokens are estimated with a deliberate ~4-characters-per-token heuristic so the pack avoids a tiktoken dependency. Input images use a tile estimate (85 base tokens + 170 per 512px tile, using the requested output size as a proxy when the real dimensions aren't known). Output tokens come from a per-quality, per-size table.
The key word is estimate. The text count is a heuristic and the input count is a proxy, so treat the number as a budget, not an invoice to reconcile later. For the cases where the table has exact figures - output tokens at a given size and quality - it's very close to what OpenAI publishes.
The inputs that matter
Mostly you just mirror what you'd set on the Generate or Edit node:
- model / size / quality / n - copy them from the real call.
- input_images - the number of reference images, 0 to 9. This is how the node knows it's estimating a Generate call (0) or an Edit call (1–9), and it's where the "image in" line comes from.
- cached_input - toggle to bill input images at the cached rate ($2/M), a
gpt-image-2-only option worth checking if you re-edit the same source images repeatedly.
Reading the outputs
Five outputs, and you'll want exactly two of them. Wire summary (STRING) into a ShowText node and you get a readable breakdown instead of raw numbers:
gpt-image-2 | 4× 1024x1024 high
text in: 18 tok → $0.0001
image in: 0 tok → $0.0000
image out: 28132 tok → $0.8440
total: $0.8441
The scalar outputs - text_tokens, image_in_tokens, image_out_tokens (INTs) and usd_cost (FLOAT) - are there if you want to branch your workflow on cost, say, or feed the number into a condition. The single lesson in that example is where the money lives: image output. Four high-quality 1024² renders is ~$0.84, and a 2048x2048 high render scales to roughly four times the output tokens of a 1024². Size and quality are your cost levers, not the prompt.
Install
Same pack, same install - Manager → Install via Git URL, or:
cd ComfyUI/custom_nodes
git clone https://github.com/graedance/comfyui-gpt-image-2.git
cd comfyui-gpt-image-2
pip install -r requirements.txt
No API key needed for this one, since it never calls anything. The honesty of the whole pack is worth a nod: an author who ships a cost estimator alongside a metered API node is an author who knows you'll check. It's MIT, single-file, and readable - do the 30-second skim before you hand it your key.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gpt-image-2 | 5 options: gpt-image-2, gpt-image-2-2026-04-21, gpt-image-1.5, gpt-image-1, gpt-image-1-mini |
| prompt | STRING | — | |
| size | COMBO | 1024x1024 | 10 options: auto, 1024x1024, 1024x1536, 1536x1024, 1792x1024, 1024x1792, +4 |
| quality | COMBO | high | 4 options: auto, low, medium, high |
| n | INT | 11–8 | — |
| input_images | INT | 00–9 | Number of reference images (0 for generate, 1–9 for edit) |
| cached_input | BOOLEAN | false | Bill input images at the cached rate (gpt-image-2 only) |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| text_tokens | INT | — |
| image_in_tokens | INT | — |
| image_out_tokens | INT | — |
| usd_cost | FLOAT | — |
| summary | STRING | — |