pxpipe reduces Claude Code token costs by rendering context as images

pxpipe is a local proxy that converts bulky text context into PNGs, reducing token usage for models like Claude Fable 5 and Gemini 4.

cpaua2 min224
pxpipe reduces Claude Code token costs by rendering context as images
photo_3411.jpg

The teamchong repository introduces pxpipe, a local proxy designed to cut input token usage for coding agents by rendering bulky context as images. By converting system prompts, tool documentation, and history into compact PNGs, the tool can reduce end-to-end bills by 59–70% on original Claude Fable 5 runs. This approach leverages the vision channel used by Anthropic's computer use, packing approximately 3.1 characters per image-token compared to roughly 1 character per text-token.

Model performance on dense pixel reading

Not all vision encoders handle dense 5×8 bitmap glyphs with equal accuracy. Gemini 4 (gemini-4-argon) is the first model to achieve 15/15 on pure-image dense hex and 100/100 on pure-image arithmetic. Gemini 3.6–3.8 Flash models also show high fidelity, scoring 14/15 on hex.

Original Claude Fable 5 scored 13/15 on hex, with SWE-bench Lite results of 10/10 and SWE-bench Pro at 14/19. However, later releases including claude-opus-5-5, claude-sonnet-5-5, and claude-haiku-5-5 regressed sharply, scoring between 0/15 and 3/15 on dense pixel reading. The claude-fable-5-1 and claude-fable-5-2 versions recover to 11/15–14/15 when using +2px row spacing.

Running the proxy and exporting images

The tool operates as a proxy on 127.0.0.1:47821 and compresses only the request, leaving the model's output as text. It supports various CLIs including Antigravity (agy) and Claude Code. Users can launch the proxy and warp their CLI tools using these commands:

bash
npx pxpipe-proxy
pxpipe warp -- agy
pxpipe warp -- omp

For those who do not wish to run a proxy, pxpipe provides an offline export mode to render files or diffs to PNG pages for manual upload to clients like Cursor:

bash
npx pxpipe-proxy export src/
cat prompt.txt | npx pxpipe-proxy export --stdin
npx pxpipe-proxy export --git

Token density and accuracy trade-offs

The system uses a bounded 96-token factsheet to help models disambiguate similar pixels, such as 0 and 8 in Spleen 5×8. Without this factsheet, Gemini 4 scored 28/30 on planted hex IDs in the TokenSave corpus, but the factsheet recovers these to 30/30. This is critical for byte-exact work, as lossy compression can lead to incorrectly read IDs, hashes, or secrets.

The efficiency of the tool depends on the workload. It provides significant gains on token-dense content like JSON or code, but may lose money on sparse prose where text tokens are more efficient than image tokens.

Sources

teamchong/pxpipegithub.com/teamchong/pxpipe
Share

Author

cpaua

VibeCode blog admin. Writing about vibe coding, AI and open source.

Related news

Comments

To leave a comment, log in
Loading...

Weekly digest

The best of vibe coding, AI agents and open source — once a week, no spam.