RC RANDOM CHAOS

pxpipe: a local proxy that images your LLM context to cut input tokens ~60%

· via Hacker News

Original source

60% Fable cost cut by converting code to images and having the model OCR it

Hacker News →

pxpipe is an open-source local proxy that sits between Claude Code and the Anthropic API and rewrites the bulky, static parts of each request — system prompt, tool docs, and older conversation history — into compact PNGs that the model reads via OCR. The trick exploits a billing quirk: an image’s token cost is set by its pixel dimensions, not the amount of text packed inside it. Dense material like code, JSON, and logs crams roughly three characters per image-token versus about one per text-token, so the project claims a sample of ~25k text tokens can be rendered as ~2.7k image tokens. Recent turns and anything needing exact recall stay as text; a built-in gate only images content where the math actually pays off.

The author frames token reduction as the durable win and dollars as a volatile downstream effect, pegging current savings at roughly 59–70% off the end-to-end bill. The big caveat is that the technique is lossy and fails silently: in a needle-in-a-haystack test, exact 12-character hex strings came back 0/15 on Opus and 13/15 on Fable 5, with wrong answers presented as plausible rather than flagged as errors. So IDs, hashes, secrets, and exact numbers must be kept as text, and the tool is tuned for Fable 5 — which reportedly OCRs these renders at 100/100 — while Opus 4.7/4.8 is off by default after misreading about 7% of images. An escape hatch routes work that needs byte-exact values to a non-imaged subagent model.

On task performance the project reports rough parity: 10/10 resolved on both arms of a small SWE-bench Lite pilot at about half the token cost, and 14/19 versus 15/19 on the harder SWE-bench Pro set, with the single divergence attributed to normal run-to-run agentic variance after it re-resolved on replication. The pitch is genuinely clever and the receipts (events.jsonl, eval directories, count_tokens counterfactuals) are unusually transparent, but the samples are tiny, the confabulation risk is real and unguarded, and the whole approach is a bet that OCR legibility holds up as models and pricing shift. It’s a gist tier for context, not a lossless store.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.