Vision Calls Cost More Than Text

image token cost and resizing

Part of: Caption & Alt-Text Generator

An image doesn't have a fixed price. A phone photo and a thumbnail cost wildly different amounts on the same model call, because vision models charge by pixels, not by file size. This lesson builds the estimator that tells you the bill before you send anything. How image tokens are counted Text tokens come from characters. Image tokens come from resolution. A widely used approximation: A 1000x750 photo costs roughly 750,000 // 750 = 1000 tokens before you write a single word of prompt. A 4000x3000 photo from a modern phone costs sixteen times that, about 16,000 tokens, for the same picture at a bigger size. Why this matters for a captioning tool Your product runs on every image a user uploads, and phone cameras default to resolutions the model doesn't need for a one-sentence caption. Sending a full-resolution photo to ask "describe this in one sentence" is like mailing a moving truck to deliver a postcard. Deciding when to downscale The key idea is scaling both dimensions by the square root of the token ratio. Tokens grow with area (width times height), so to halve the tokens you shrink each side by roughly 71 percent, not 50. Estimating the full call cost The image, your instructi

Challenge: Estimate the Vision Call Cost