How Claude Calculates Token Costs for Images: Pixels, Not File Size
Anthropic's Claude charges for images based on pixel dimensions, not file size or format, using the formula: tokens ≈ (width × height) / 750. This means compressing an image reduces upload bandwidth but does not lower API costs, while resizing it reduces both. Two built-in limits cap per-image cost: the long edge is scaled down if it exceeds 1,568 pixels, and a secondary ceiling keeps any single image at roughly 1,600 tokens regardless of resolution. In practice, a 12-megapixel phone photo and a 2-megapixel photo of the same scene cost approximately the same number of tokens after these reductions apply. Developers can use Anthropic's count_tokens endpoint for precise pre-request estimates and are advised to recheck official documentation before building cost budgets around these figures.
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