teamchong/pxpipe
cut Claude Code token usage by rendering text context as images
What it solves
pxpipe reduces the cost and token usage of AI agents (specifically Claude Code) by converting bulky text context—such as system prompts, tool documentation, and older chat history—into compact PNG images. Because vision tokens are billed based on image dimensions rather than text length, dense content can be packed into images to significantly lower the end-to-end bill (reported savings of 59–70%) and effectively increase the model's context window capacity.
How it works
It operates as a local proxy that intercepts requests to AI providers (Anthropic, OpenAI, Google). When it detects "bulky" token-dense content (like large tool outputs or old history), it renders that text into optimized PNG pages based on model-specific profiles (controlling glyphs, columns, and geometry). These images are then sent to the model via the vision channel. To mitigate the loss of precision for critical identifiers (like hashes or IDs), it includes a bounded "factsheet" of recognized precision-critical tokens as text.
Who it’s for
Developers using AI agents or LLM-based coding tools (like Claude Code, Cursor, or Codex) who deal with massive context windows and high API costs.
Highlights
- Significant Token Reduction: Cuts request size by 60-70% for dense content.
- Context Expansion: Increases effective character capacity of 1M-token windows by up to 5.3x.
- Model-Specific Profiles: Tailored rendering for different models (e.g., Claude Fable 5, Gemini 3.6 Flash, Grok 4.5).
- Transparent Proxy: Can be run as a proxy or used as a standalone library for offline exports.
- Profitability Gate: Only images content where the token-to-pixel math actually results in savings.
- Lossy Compression: Acknowledges that exact string recall (like hex strings) is not 100% byte-safe, though it provides a factsheet for critical tokens.
Related
- Dispatch
- Project
- Project
- Project
- Project