Image dimensions, not file size, determine AI vision API token costs
When sending images to AI vision APIs, the number of input tokens charged depends entirely on an image's pixel dimensions, not its file size or compression level. This is because providers decode images to a raw pixel grid before processing, meaning a 40 KB JPEG and a 4 MB PNG of identical dimensions cost exactly the same. Each major provider uses its own formula: OpenAI tiles images into 512×512 patches after resizing, Anthropic applies a straightforward area-divided-by-750 calculation, and Google uses a flat 258-token tile system with a sharp cost jump above 384 pixels per side. The most effective way to reduce costs is resizing images before upload, since compressing files more aggressively only saves bandwidth, not tokens. These formulas were accurate as of August 2026 based on each provider's own documentation, but should be verified before use as rates and rules can change.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in