ai newsMi., 21. Okt.
EilmeldungOpenAI acquires Orchestra Bio to build AI agents that speed up drug development

Sending text as images cut my Claude tokens by up to 81%. It also started inventing numbers.

There is a trick going around for cutting Claude Code bills: render bulky context (system prompt, tool docs, logs, old history) as dense PNG images instead of text. An image is billed by its pixel size, not by how much text is inside it, so a page packed with small characters can cost far fewer tok

dev.toMittwoch 09:14 · 21.10.2 Min. Lesezeit
Bild: dev.to

There is a trick going around for cutting Claude Code bills: render bulky context (system prompt, tool docs, logs, old history) as dense PNG images instead of text. An image is billed by its pixel size, not by how much text is inside it, so a page packed with small characters can cost far fewer tokens than the same text.

The open-source proxy pxpipe does exactly this and reports a 59-70% lower bill. Its own README is honest that the method is lossy. I wanted an independent number for both sides: how many tokens it really saves, and what the model can still read back.

(Opus 5.5; Haiku and Sonnet were the same within a few tokens. Fable's denser layout: -68% to -81%.)

The more tokens a language costs as text, the more an image saves. Korean and Japanese gained the most.

As plain text, every model answered every item correctly. Through pxpipe:

Use image context for what the model needs to understand, not for what it needs to copy. A long article to summarize, a design doc to review, old conversation history: fine. Ids, hashes, prices, line numbers, code you want edited: keep them as text.

Because the saving is large for long non-English text, I added an experimental Text → image button to the free token counter at https://tokensave.app. It renders your text into PNG pages in the browser (nothing is uploaded), estimates the image tokens for the GPT, Claude or Gemini model you picked next to the text tokens, and lets you copy or download the pages. A 9,000-character Korean article came out at about 1,400 image tokens on Claude versus 8,229 as text.

Two caveats. The button uses a larger, plainer font than pxpipe's 5x8 pixel cells, so it saves somewhat less and I have not measured its read-back accuracy yet. And the warning above applies: do not use it for anything that has to be exact.

Two runs per cell and six documents, so treat single cells as examples. I measured exact recall only; pxpipe's own tests report good results on gist and arithmetic questions, which I did not repeat. In normal use pxpipe images older history and the system prompt while recent turns stay text, so the saving on a full bill depends on your session.

Full tables, method and CSV (CC BY 4.0): https://tokensave.app/data/text-as-image-token-cost Corpus, rendered pages, raw answers and scripts: https://github.com/johnisking/token-cost-by-language/tree/main/text-as-image

Quelle: dev.to (dev.to). Original öffnen