Mid · 7 chapters
Image inputs
Resolution and tiling, image token cost, prompting with images
Treat image handling as an API-cost and reliability concern: careless resizing can create surprise bills or silently destroy the text a downstream workflow needs.
Read these first
What you will know
Send an image to a model and get a useful answer about it
Send a screenshot or a chart and ask a question about it. The capability is better than most people expect.
Measure how image resolution and tiling change token cost for a chosen provider
A resize can cross tile boundaries, causing stepwise cost jumps rather than smooth scaling.
Calculate the token cost of an image before sending it
Pricing and vision-token formulas vary by model, and rounding or minimum charges can invalidate rough pixel-based guesses.
Run the same image at two downscaled resolutions and record which answer-critical details disappear
Tiny text usually fails before broad scene or chart structure, making aggressive compression especially risky for document tasks.
Compare a vision model with a dedicated parser on one chart or scanned document using accuracy and latency
Vision can preserve layout and semantics, while parsers often win on exact text extraction, repeatability, and predictable cost.
Chapters
- 1
Image content blocks
An image reaches a model as another typed block in a message's content list, beside the text rather than in an attachment field, and it is charged as input on every request that carries it. This chapter covers what a vision model can actually read, how the request is built in JSON and in Python, how to ask a question the image can answer, and why several images in one message need a text label each.
- 2
Image token cost
An image is priced on its pixel dimensions after a server-side resize you did not ask for, not on the bytes you uploaded, and the formula differs by provider: some divide area by a constant, some count fixed 512-pixel tiles, and all of them have a floor and a ceiling. This chapter shows the order of the steps, an estimator you can run before sending, measured per-image figures, and why a model upgrade can triple the bill with no change to the request.
- 3
Resolution and per-field legibility
Halving an image's resolution does not degrade every extracted field equally: layout, chart shape and large type survive it untouched while 8-point footnotes collapse, because a glyph stroke narrower than a pixel becomes a smear. This chapter gives the two-resolution measurement protocol, the ground truth it needs, the cap-height thresholds that explain the ordering, and the traps that make the experiment measure nothing.
- 4
Tile-based image pricing
Where a provider bills images by 512-pixel tiles, cost is a step function: 1024x1024 and 800x800 both normalise to the same 2x2 grid, so a resize between them removes 39% of the pixels and none of the bill. This chapter works the tiling arithmetic, tabulates the staircase by aspect ratio, gives a sweep that measures the real boundaries for your model, and shows how to read a small saving as evidence that most images never moved.
- 5
The image detail parameter
Where a provider exposes a detail control, it selects between two processing paths rather than sliding a quality dial: low sends one heavily downscaled view at a flat token cost, roughly nine times cheaper, and is right for large high-contrast questions. On a document it puts the text below the resolution the model can resolve and the model answers anyway, with plausible values that appear on no original. This chapter covers the arithmetic, the per-task binding, and escalation.
- 6
OCR pipelines and vision models
On a document extractor at volume, accuracy is the least decisive input: determinism, per-page cost multiplied by reprocessing, and whether errors carry a signal decide it. OCR plus rules is exact, repeatable, cheap to re-run and flags its own low-confidence fields; a vision model reads what no rule was written for and returns well-formed wrong numbers. This chapter runs the comparison and derives the split it implies.
- 7
Error independence in repeated runs
Accepting a field only when two runs agree multiplies error rates together only if the two runs fail for different reasons. Two resolutions of one image are nested rather than independent: the smaller run sees a strict subset, so disagreements are mostly it being wrong about cases the larger run had right, and a faint digit misread identically at both sizes agrees. This chapter measures the correlation and ranks checks that do carry signal.
External resources
- Vision — Claude Platform Docsdocs.anthropic.com
Resolution limits, token-count formula and per-image cost math.
- Images and vision — OpenAI API guidedevelopers.openai.com
Detail levels and tiling rules that decide your image token bill.
- ERASE: Eliminating Redundant Visual Tokens via Two-Stage Token Pruningarxiv.org
Explains why tiled images explode token counts and how pruning claws it back.
- Messages APIplatform.claude.com
Shows image inputs, resolution, tiling, token costs, and prompting through the Messages API.
- Using the Messages APIplatform.claude.com
Shows image inputs through the Messages API: resolution, tiling, token costs, and prompting.
- Gemini APIai.google.dev
Shows how Gemini handles image resolution, tiling, token costs, and image prompting.
- Using the Messages API — vision examplesdocs.anthropic.com
Ready-to-run image request bodies including base64 and multi-image.
- Claude Cookbookplatform.claude.com
Multimodal notebooks for prompting patterns that work with images.
- Claude API: How to get a key and use the APIzapier.com
Shows how to use Claude’s API, including image inputs, prompting, and token considerations.
- How LLMs Really Understand Images.PY
How images become patches and tokens, which is what drives resolution cost
- Getting Started with GPT-4o API, Image Understanding, Function Calling and MOREPrompt Engineering
Sending images through the API and prompting over them from backend code
- OpenAI Vision API Tutorial: Extract JSON Data from Images (Node.js)Leon van Zyl
Shows how to prompt vision models for structured data extraction from images.
- Introduction to Gemini APIs and AI StudioGoogle for Developers
Shows Gemini image resolution, tiling, token costs, and prompting through APIs and AI Studio.