HeadlinesBriefing favicon HeadlinesBriefing.com

pxpipe Slashes Claude Token Costs by Rendering Text as Images

Hacker News •
×

A new tool named pxpipe offers a novel approach to reducing AI inference costs by converting bulky text inputs into images. Developed by teamchong, this local proxy intercepts system prompts, tool documentation, and conversation history, transforming them into compact PNG files before they reach the AI model. This method exploits the fact that image token costs are based on pixel dimensions, not content density.

pxpipe significantly cuts token usage for dense content, like code or JSON, which can pack around 3.1 characters per image-token compared to roughly 1 character per text-token. In practical tests, a 25,000-token text input was rendered as approximately 2,700 image tokens. This translates to substantial cost savings, with reported reductions of ~59–70% on end-to-end bills for Fable 5, and up to ~72–74% on compressed requests.

While effective, pxpipe introduces a lossy element; exact numerical values or short strings might not be perfectly recalled. The tool defaults to imaging Fable 5 requests, with options to configure other models or disable imaging entirely. For critical data requiring byte-exact recall, users can route those specific tasks to non-imaged models, ensuring both cost efficiency and data integrity.