GPT Image 2.5 cost calculator in Python: token grid, checked vs Sume
A short Python function reproduces Sume's GPT Image 2.5 prices from the token grid, $0.0074 at low and $0.2635 at max for 1024x1024. Table to check it.

You can price a GPT Image 2.5 image offline with a short Python function that multiplies a quality grid by a size term, converts tokens to dollars at $30 per million, rounds the provider total up to $0.0001, and applies Sume's 1.25 factor. The function below returns $0.0074 for 1024x1024 at low and $0.2635 at max, which are the figures Sume quotes.
The formula comes from the token calculator in OpenAI's image generation guide (read 2026-10-05) and from Sume's Image API page, which states the $30 per million output-token rate and the Fal rounding. The function covers the output side only. A text prompt and each reference image add input tokens on top.
The function
GRID holds the quality grid: 16 for low, 24 for medium, 48 for high, 64 for xhigh and 96 for max. The short side of the image is scaled by the grid and rounded to a whole number, and the result multiplies a pixel-count term. The script prints one row per size, and the rounding line is the only part that is not in the OpenAI calculator: Fal rounds the provider total up to the next $0.0001, which the provider line reproduces in micro-dollars before the Sume factor is applied. Python's round rounds exact halves to even, which matches the tie rule the estimator uses.
import math
GRID = {"low": 16, "medium": 24, "high": 48, "xhigh": 64, "max": 96}
def sume_price(quality, width, height):
grid = GRID[quality]
short = grid * min(width, height) / max(width, height)
tokens = math.ceil(grid * round(short) * (2_000_000 + width * height) / 4_000_000)
provider = math.ceil(tokens * 30 / 100) * 100
return provider * 1.25 / 1_000_000
for size in [(1024, 1024), (1536, 1024), (2560, 1440), (3840, 2160)]:
row = [f"{sume_price(q, *size):.4f}" for q in GRID]
print(f"{size[0]}x{size[1]}", *row)Check it against Sume
Running the script gives these rows. They match Sume's quotes for a one-character prompt, so any drift on your side is a sign that a rate or a rounding rule changed.
| Size | low | medium | high | xhigh | max |
|---|---|---|---|---|---|
| 1024x1024 | $0.0074 | $0.0165 | $0.0659 | $0.1171 | $0.2635 |
| 1536x1024 | $0.0060 | $0.0129 | $0.0515 | $0.0922 | $0.2059 |
| 2560x1440 | $0.0077 | $0.0180 | $0.0691 | $0.1229 | $0.2765 |
| 3840x2160 | $0.0140 | $0.0325 | $0.1251 | $0.2225 | $0.5004 |
What the function leaves out
The calculator is an estimate of the output side. Here is what else lands on the bill.
- Text input. The prompt is billed at $5 per million text tokens, which is a few hundredths of a cent for a normal prompt.
- References. Each reference image is estimated at the output image's token count and billed at $8 per million, so an edit costs about 27% more per reference.
- Auto settings.
quality: autoreserves themaxprice, and a missing orautoimage_sizereserves the upper bound of 96-grid output tokens. n. The cost is the per-image price times the number of images.
Using it
Put the function in a budget check that runs before a batch: sum the price for every planned call, compare the total with a cap, and refuse to start if it is above. After the batch, compare the sum of usage.cost from the responses with the estimate. A gap beyond a few percent means a prompt was long, a reference was added or a size was left out.
Keep the grid, rate and factor as named constants at the top of your module so a change is a one-line edit. If Sume or the provider changes a rate, the figures in the table above will stop matching, and the check against a live usage.cost is the quickest way to notice.
One more use is sizing a plan. Feed the function the sizes and tiers in your real traffic, multiply by the monthly counts, and you have a bill forecast without a single API call. Because the function is deterministic, you can also use it in unit tests: assert that a request builder never produces a call priced above a limit you set, and the test fails before a costly change ships.
The prompt term is the one number the function ignores. If your prompts are long, count them at about four characters per token and add $5 per million tokens, which is still tiny beside the output side for any tier above low.
Sources
Related posts
More in Developers
- GPT Image 2.5 cached input works only on the Responses API
OpenAI's cached-input rates ($1.25-$2.00 per 1M) for GPT Image 2.5 apply only to Responses API images. Sume bills token rates with margin and no cache discount.
- GPT Image 2.5 references: OpenAI's page says 4, Sume accepts 16
OpenAI's image guide says up to four input images; Sume's docs allow 16 input_references on ChatGPT Image 2.5. The pages disagree, so test your count.
- GPT Image 2.5 output_compression returns 400 on Sume: use Pillow
OpenAI offers output_compression 0-100 for JPEG and WebP; Sume returns 400 unsupported_parameter for it. Request png, jpeg or webp, then compress with Pillow.
- Graph API rate-limit codes 4, 17, 32, 613: stop, reuse the Sume job
Meta documents error codes 4, 17, 32 and 613 for rate limits. Map each to a pause and publish the stored Sume result later instead of re-rendering.
Written by Sume