Labs / research
Logs as pixels
Abstract
Providers meter text and images differently on the same request. On Anthropic's API an image costs roughly one input token per 750 pixels of area, while text costs whatever the tokenizer counts; these are two prices for delivering the same content, and for some payloads the image meter is cheaper. We describe a deterministic text-to-PNG transform, ported from pxpipe (MIT), that exploits the gap; a decision gate that computes both sides of the trade per request with a 10 percent safety margin; and measurements showing that a plainly readable render is never profitable while dense packing cut estimated input tokens by 61 to 76 percent on the payloads we converted. We close with the failure modes and the safety constraints under which the transform ships.
1. Two meters, one payload
Anthropic prices an image at approximately width times height divided by 750 input tokens (Anthropic vision documentation); text is priced by the tokenizer. Nothing forces those two numbers to agree on the same content, and for long, regular payloads they diverge enough to matter. The interesting question is not whether the trick can work; it is which payloads sit on the profitable side of the divergence, and how the system refuses the rest.
2. The renderer
The pixel path renders text into a PNG using an embedded glyph atlas and sends the image in place of the text. The model reads it the way it reads a screenshot. The renderer is deterministic, so the same bytes in produce the same image out, and line breaks survive as a visible sentinel glyph. Every render is verified before use: if even one character fails to render, the transform abandons the attempt and the original text goes upstream unchanged.
One layout choice decides profitability. A plain, human-readable render never wins (§4). What wins is dense packing, which trades human readability for pixel economy.
3. The decision gate
Nothing is transformed on faith. The engine estimates both sides of the trade before acting: estimated image tokens at the 750-pixels-per-token rate against estimated text tokens, with a 1.10 multiplier applied to the image side as a safety margin (ImageCostSafetyMargin = 1.10 in the gate). Only a payload that is still cheaper after the margin gets rendered. The gate recomputes on every request rather than trusting yesterday's pricing.
4. Measurements
The measured case is a 5 KB skill file converted through the pipeline.
| Encoding | Estimated input tokens | Versus text |
|---|---|---|
| Original text | 1,178 | baseline |
| Plain readable render | 1,491 | +27% |
| Dense-packed render | 313 | −73% |
Letters carry air. A readable raster of prose spends most of its pixels on whitespace and glyph padding, and the image meter charges for all of it, which is why the plain render costs more than the text it replaces. Across the payloads we have converted, dense packing cut estimated input tokens by 61 to 76 percent; plain rendering never once made the profitable list.
The favorable payloads share a shape: long, repetitive, structured. Logs, structured dumps, skill bodies, boilerplate the model must see but will not quote back. The larger and more regular the payload, the further the fixed pixel overhead amortizes.
5. Failure modes
Short payloads lose; padding and glyph-cell overhead dominate before the content earns anything back.
Cached content loses badly. Anthropic bills a cache read at a tenth of the normal input rate, so rendering already-cached text into fresh images replaces the cheapest tokens on the invoice with full-price image tokens.
Content the model must reproduce byte-exact is a poor fit, because the model is then transcribing from pixels rather than copying tokens.
The entire trade is also a function of provider pricing. If the pixel rate or the cache discount moves, the profitable set moves with it, which is the second reason the gate recomputes per request.
6. Deployment constraints
Pixel rendering is an S4 lossy transform in the safety ladder, the only class permitted to change model-visible bytes, and it carries that class's full obligations. The original bytes are written to the CCR store before anything is transformed, so recovery is byte-exact. The path is allowlist-gated to models we have measured; the automatic content router never selects it; record mode never touches it. On any parse, render, or storage error the request passes through unchanged.
All savings this transform reports are labeled inferred, like every estimate in the stack, and stay that way until the transform earns promotion through an eval gate on real traffic. The summary we stand behind: text as pixels is a real discount on the right payloads and a tax on the wrong ones, so the product is the gate, not the render.
References
- Anthropic. Vision: image token estimation. docs.anthropic.com.
- pxpipe (MIT), the source of the ported rendering pipeline.