Converting Code to Images and Having the Model OCR It Cuts Fable Costs by 60%
Key point
Introduces a technique that dramatically reduces API costs by using images instead of text to cut down on LLM input token counts.
Details
pxpipe is a local proxy tool developed to reduce input token costs for AI coding tools like Claude Code. This technology renders text-heavy context—such as system prompts, tool documentation, and previous conversation history—as PNG images before passing them to the model.
Since image token costs are fixed based on pixel size rather than the amount of text, efficiency is maximized when converting dense text data (code, JSON, etc.) into images. According to real-world cases, approximately 25,000 text tokens can be compressed into 2,700 image tokens.
Key features and results include:
- Cost reduction: Based on Fable API pricing, this approach reduces end-to-end costs by approximately 59-70%.
- Context efficiency: By processing large contexts as images, it lowers the model's context window usage.
- Accuracy: With the Fable 5 model, it shows a high reading accuracy of 100/100 for complex data converted into images.
- How it works: Text is restructured into high-density images with minimized whitespace and line-break (↵) markers, prompting the model to read it via OCR.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.