Kolkata ·  
AI engineering
beyond text
deep · 6 min

Vision models

How a language model reads images: cut into patches, turned into vectors, read as tokens next to the text.

updated 29 Sept 2026

We send Claude a 1000×1000 photo and a question about it. What does the model actually get?

Not pixels, exactly. It gets 1,296 tokens, and we pay for 1,296 input tokens, the same as if we'd pasted in 1,296 tokens of text. Where does that number come from? Let's follow the photo through.

The photo becomes a grid

The API covers the image with squares 28 pixels on a side. A thousand pixels is about 36 squares across and 36 down, and 36 × 36 is 1,296. Each square is called a patch, and each patch becomes one token.

The idea of treating an image this way comes from the Vision Transformer, ViT, published in 2020. Text models already worked on a sequence of tokens. So what if an image were a sequence too? ViT cuts the image into fixed-size squares (16×16 pixels in its best-known version). It flattens each square into one long list of pixel values. A learned layer turns that list into a vector the size the model works with, which is the image version of a token embedding. Then it adds a position embedding so the model knows where the square came from, and feeds the whole sequence into an ordinary transformer.

Notice what this means for cost. The number of patches is the image's area divided by a patch's area. Double the width and the height and we get four times the patches, four times the tokens.

Making those vectors mean something

A ViT on its own learns whatever its training task rewards. In 2020 that was sorting images into classes, and it only matched older image networks when trained on a lot of data. To sit next to a language model, though, its vectors need to line up with what words mean. How do you teach that?

CLIP, from OpenAI in 2021, did it with captions. It trained an image encoder and a text encoder together on 400 million image and caption pairs scraped from the internet. Each training step takes a batch of images and their captions, turns them all into vectors, and pushes every image's vector towards its own caption's vector (measured with cosine similarity) and away from all the other captions in the batch. The whole task is: which caption goes with which image?

What comes out is an image encoder whose vectors already live in a space shaped by language. With no extra training, CLIP matched a standard image classifier that had been trained on 1.28 million labeled examples. One of CLIP's encoders was a ViT with 14-pixel patches.

Plugging it into a language model

Now we have image vectors that mean something. How does a chat model read them? LLaVA, in 2023, showed about the simplest way. Three parts: CLIP's image encoder, used as is. A language model. And between them, one trainable matrix that turns each image vector into the same size as the language model's word vectors.

After that matrix, the image vectors are just tokens. The language model reads them in the same sequence as the question and writes its answer one token at a time, like always.

Training happened in two steps. First only the matrix learned, on 595,000 image and caption pairs, with the encoder and the language model both frozen. That teaches it to translate between the two. Then the language model learned too, on questions and answers about images (which were written by GPT-4 working from text alone).

Other models use fancier connectors between the two halves. The shape is the same everywhere in the published research: an image encoder, something that maps its output into the language model's space, and a language model that reads the result.

Same image, different bills

Every provider turns images into tokens, but they don't count them the same way. Claude uses those 28-pixel patches. Newer OpenAI models use 32-pixel patches times a per-model factor (1.2 for most current ones). Older OpenAI models, like gpt-4o, shrink the image, cover it with 512-pixel tiles and charge 170 tokens per tile plus a flat 85.

And they all have size caps. Newer Claude models (4.7 and later) allow a long edge up to 2,576 pixels; older ones shrink anything past 1,568 pixels and 1,568 tokens. OpenAI has a detail setting that picks the budget, from shrinking the image into 512×512 up to an original mode for big, dense images.

So here's one 1920×1080 screenshot, as of 2026-09. The Claude numbers are from Anthropic's table; the OpenAI ones we worked out from OpenAI's formulas at detail: high.

From about 1,100 to 2,700 tokens for the same picture. Is the cheap one a bargain? Not really. The cheaper counts are cheaper because the image got shrunk more, so the model saw less. Prices per token differ too (see token pricing); Anthropic's own example puts a 1000×1000 image at about $1.30 per thousand images on Haiku 4.5 and about $6.48 per thousand on Opus 5.

That shrinking is where small text dies. When an image goes over the cap, it's scaled down before the model sees it, and text that was readable can turn to mush. Both providers list small text, rotated images and tiny images as weak spots. So crop to the part you care about on your side, before sending, and you decide what's lost instead of the API. And re-measure token counts when you switch models; a number from one doesn't carry over.

It saw the lines. Why can't it count them?

Here's a strange result. In 2024, researchers gave four leading vision models really simple drawings. Do these two circles overlap? How many times do these two lines cross? Which letter has a circle around it? Things any person gets right every time.

The models averaged 58%. The best got 78%. When the shapes were spread apart they did fine; when they overlapped or sat close, they fell apart.

You'd guess the image encoder just couldn't see the fine detail. But when the researchers probed the encoder's output, the information was there. The failure came after, in the language model turning those vectors into an answer.

Those were 2024 models. The weak spots they found (overlap, counting, exact positions) are still the ones provider docs warn about now. Claude's docs call its counts and coordinates approximate. So treat a count or a position from a vision model as a guess, and check it with a small eval set of your own images.

One thing we can't tell you is how the production models are built. Anthropic and OpenAI document how images are billed, not how their encoders work, and we found no primary source from either (or from Google) describing one. That 28- or 32-pixel patch might be the encoder's real patch size, or just a billing unit. ViT, CLIP and LLaVA are the public research these systems grew out of, and they're the best picture we've got. Running the same machinery over every page of a document is the next step, PDF input.

Further reading