pxpipe: Cut Claude Code Token Usage 60% by Rendering Context as Images

pxpipe is a local proxy that exploits a pricing gap: AI models charge for images by pixel dimensions, not by embedded text density. For bulky context like system prompts, tool docs, and history, this means ~3.1 characters per image token vs ~1 char per text token on real Claude Code traffic. The result is a ~59–70% cost cut (list prices) and a ~72–74% cut on compressed requests, with the primary metric being input-token reduction — e.g., ~25k text tokens rendered as ~2.7k image tokens.
How it Works
pxpipe runs as a local proxy intercepting requests from Claude Code/Gateway. It rewrites the bulky parts (system prompt, tool documentation, older history) into compact PNG images before the request leaves your machine. The proxy also includes an OCR instruction banner co-rendered on top so the model can read the text reliably. Fable 5 achieves 100/100 read accuracy on a clean eval. Opus 4.8 struggles with dense image content (exact values should remain text).
Getting Started
npx pxpipe-proxy
# proxy on 127.0.0.1:47821
ANTHROPIC_BASE_URL=http://localhost:47821 claude
Open http://127.0.0.1:47821/ for a live dashboard showing tokens saved, per-session stats, and every text→image conversion side by side.
Key Results
- Token reduction: Dense content compresses ~10x (25k text → 2.7k image tokens)
- Cost savings: 59–70% lower bill on typical Claude Code traffic, 72–74% on compressed requests
- Accuracy: Fable 5 model reads images at 100/100 on clean eval; Opus 4.8 is lossy for exact values
- Demo comparison: Session totals: plain $42.21 (context 96% full) vs pxpipe $6.06 (context 7.4% full)
Limitations
Spare or small requests won't benefit. Opus 4.8 cannot reliably read exact values from images (e.g., phrase counts). Single-reply format compliance has minor rough edges (one follow-up nudges may be needed).
Who It's For
Developers using Claude Code with large system prompts, extensive tool docs, or long conversation histories — especially in Fable 5 environments.
📖 Read the full source: HN AI Agents
👀 See Also

Layered Defense Framework for Claude Code Rule Enforcement
An IT operations professional built an 8-layer defense framework to enforce Claude Code rules after discovering that both CLAUDE.md prompts and blocking hooks could be bypassed. The approach adapts the Swiss cheese model from accident investigation to prevent workarounds.

VectorClaw v1.0.0: MCP Server for Anki Vector Robot Control
VectorClaw v1.0.0 is an MCP server that enables OpenClaw to control Anki Vector robots through 23 specific tools for speech, motion, perception, sensors, and display functions.

Claude Session Tracker: Auto-Save Claude Code Sessions to GitHub Issues
A new tool called claude-session-tracker automatically saves Claude Code sessions to GitHub Issues, logging every prompt and response as comments with timestamps. It creates one GitHub Issue per session linked to a Projects board and works through Claude Code's native hook system without consuming context tokens.

Native macOS MCP Server for Full OS Control
A native macOS server provides 24 tools for pixel-accurate clicks, key combos, drag-and-drop, app management, multi-display support, and clipboard access. It's open source and works with Claude Code, Cursor, or any MCP client.