An image's cost is a resolution formula, not a file size
Send a 50 KB compressed JPEG or a 5 MB uncompressed PNG of the exact same photo, and every major vision API charges the такой же number of tokens — because none of them bill on bytes. They bill on width and height, run through a formula that converts pixel area into a token count, the same unit used for text. That formula is different for every provider, and it's rarely the first thing a team checks before shipping a feature that uploads screenshots, photos or scanned documents.
Image token calculator →OpenAI: two different systems, depending on the model
Legacy tile system (GPT-4o, GPT-4o mini, older vision models). In high-detail mode, the image is scaled to fit a grid of 512-pixel tiles, then billed as 85 base tokens + 170 tokens per tile. A 1024x1024 photo needs 4 tiles (2x2), so it costs 85 + (4 × 170) = 765 tokens. Low-detail mode skips tiling entirely and charges a flat 85 tokens regardless of resolution, because the image is downsampled to a thumbnail before the model reads it.
Patch system (GPT-4.1, GPT-5 family, o4-mini). Newer models dropped tiles for 32x32-pixel patches: patches = ceil(width/32) × ceil(height/32), with a hard cap of 1,536 tokens per image — oversized images are downscaled first so the patch count never exceeds that ceiling. A 1024x1024 image is exactly 32 × 32 = 1,024 patches, i.e. 1,024 tokens, no rounding needed. The mini and nano variants then multiply that patch count — 1.62× for the mini tier, 2.46× for nano — so the same image costs more tokens on a cheaper-per-token model, partially offsetting the lower rate.
| Модель | Formula result for 1024x1024 | Billed tokens |
|---|---|---|
| GPT-4o (legacy tiles) | 85 + 4×170 | 765 |
| GPT-5 / GPT-4.1 (patches) | 32×32 patches | 1,024 |
| GPT-4.1 mini / GPT-5 mini | 1,024 × 1.62 | ~1,659 |
| GPT-4.1 nano / GPT-5 nano | 1,024 × 2.46 | ~2,519 |
Claude and Gemini: simpler, but still resolution-driven
Anthropic's Claude uses the simplest published formula of the three vendors: tokens ≈ (width × height) / 750. The same 1024x1024 photo comes out to 1,048,576 / 750 ≈ 1,398 tokens — nearly double what the same image costs on GPT-5's patch system, because Claude's divisor isn't tuned to a fixed patch grid.
Google's Gemini charges a flat 258 tokens for any image up to 384 pixels on its longest side, then switches to tiling larger images on top of that base — the exact tile formula for large images isn't published with the same precision as OpenAI's or Anthropic's, so treat Gemini's cost on large images as a model-specific estimate rather than hand-calculated.
Vision API cost calculator →Worked example: one photo, four prices
Same 1024x1024 photo, sent as the only content of one API call, priced at each model's published input rate:
| Модель | Токены | $/1M input | Cost for this image |
|---|---|---|---|
| GPT-4.1 nano | ~2,519 | $0.10 | ~$0.00025 |
| ГПТ-4о | 765 | $2.50 | ~$0.0019 |
| ГПТ-4.1 мини | ~1,659 | $0.40 | ~$0.00066 |
| ГПТ-5 | 1,024 | $1.25 | ~$0.00128 |
| ГПТ-4.1 | 1,024 | $2.00 | ~$0.00205 |
| Клод Сонет 4.6 | ~1,398 | $3.00 | ~$0.00419 |
A single image, at the volumes most apps run, looks trivial — fractions of a cent. The gap only matters at scale: 1 million images a month at GPT-4.1 nano's rate costs about $250; the identical batch on Claude Sonnet 4.6 costs about $4,190, a 17× spread for the same pixels, before a single word of prompt is added.
LLM token cost calculator →Why resolution, not detail, drives the bill
Every formula above runs on pixel area — width times height — which grows with the квадрат of the dimension. Double an image's width and height together and you roughly quadruple its token cost on every provider's system, tile-based or patch-based. A 2048x2048 screenshot costs about 4× what the equivalent 1024x1024 crop costs, and 16× a 512x512 crop — even if the extra pixels are blank margin the model never needed to answer the question.
This is the one lever that works identically across every vendor: resize to the smallest resolution that still contains the detail the task requires, before the image leaves your server. Nothing else in this formula is negotiable — not file format, not compression, not color depth.
Распространенные ошибки
- Compressing the file instead of resizing it. A smaller JPEG at the same pixel dimensions costs the identical number of tokens — compression changes bytes on disk, not the width/height the formula reads.
- Sending full-resolution screenshots for simple classification tasks. If the question is "is there an error dialog visible," OpenAI's low-detail mode (flat 85 tokens) or a downscaled thumbnail answers it for a fraction of the cost of a high-detail read.
- Assuming a cheaper model is always cheaper on images. The mini/nano multipliers (1.62×/2.46×) mean a nano-tier model can bill more raw tokens for the same image than the flagship it's supposedly a budget version of — the lower per-token rate doesn't always win after the multiplier.
- Forgetting images stack with every other input. A multi-image conversation (product photo + screenshot + reference image) adds each image's token count on top of the text prompt, every single turn, in models without image caching.
Продолжить обучение
Как работает ценообразование LLM API →Context Window and Cost →Токены против запросов →Часто задаваемые вопросы
How many tokens does an image use?
It depends on resolution and which model you call, not file size or format. OpenAI's GPT-4o tiles the image into 512-pixel squares and charges 85 base tokens plus 170 per tile, so a 1024x1024 photo costs about 765 tokens. Newer OpenAI models (GPT-4.1 and GPT-5 family) use 32x32-pixel patches instead, capped at 1,536 tokens per image. Anthropic's Claude uses width times height divided by 750 — the same 1024x1024 photo comes to about 1,398 tokens. Google's Gemini charges a flat 258 tokens for images up to 384 pixels and tiles larger ones.
Does file size affect image token cost?
No. A heavily compressed JPEG and an uncompressed PNG of the same pixel dimensions cost the same number of tokens, because every provider's formula runs on width and height, not bytes on disk. Only resolution, and in OpenAI's legacy system the detail mode, change the token count.
Why do GPT-4.1 and GPT-5 tokenize images differently from GPT-4o?
OpenAI replaced the tile-based system with a patch-based one starting with GPT-4.1. Instead of 512-pixel tiles with a flat per-tile charge, the image is divided into 32x32-pixel patches and every patch becomes one token, up to a hard cap of 1,536 tokens per image — oversized images are downscaled first so the patch count never exceeds the cap. The mini and nano variants then multiply that patch count by 1.62x and 2.46x respectively, so the same image costs more tokens on a smaller model even though the dollar rate per token is lower.
What's the cheapest way to send images to a vision API?
Resize before you send. Token count scales with pixel area, so doubling an image's width and height roughly quadruples its cost on every provider's formula — sending a 2048x2048 screenshot when a 768x768 crop contains the same information wastes tokens for no benefit. If you only need a yes/no read on the image (is there a cat in this photo), OpenAI's low-detail mode charges a flat 85 tokens regardless of resolution by downsampling the image to a thumbnail first.
Educational reference only — formulas and prices are estimates based on published vendor documentation; confirm current rates and tokenization rules on each provider's pricing page.