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

✍️ OpenClawRadar📅 Published: July 4, 2026🔗 Source
pxpipe: Cut Claude Code Token Usage 60% by Rendering Context as Images
Ad

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.

Ad

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

Ad

👀 See Also

Layerkit: AI Image Editor with Editable Layers Built with Claude Code
Tools

Layerkit: AI Image Editor with Editable Layers Built with Claude Code

A developer built Layerkit, a browser-based AI image editor that generates scenes with editable layers to avoid constant re-prompting. The tool uses a multi-stage AI pipeline where one LLM plans composition, an image model generates the scene, and another LLM analyzes the actual image to place readable text.

OpenClawRadar
Multi-Agent Haiku System Matches Claude Opus on Complex Number Theory Problem at 15x Lower Cost
Tools

Multi-Agent Haiku System Matches Claude Opus on Complex Number Theory Problem at 15x Lower Cost

A Reddit experiment shows a two-Haiku agent system (generator + auditor) achieving identical 4/4 scores to Claude Opus 4.5 on a difficult Fermat's Little Theorem proof, while costing approximately $0.004 per query versus $0.06 for Opus.

OpenClawRadar
Open-source SwiftUI testing skill for Claude Code uses Computer Use to visually test apps
Tools

Open-source SwiftUI testing skill for Claude Code uses Computer Use to visually test apps

An open-source Claude Code skill called /ios-test visually tests SwiftUI apps using Computer Use capability. The agent finds .xcodeproj files, builds the app in a Simulator, then navigates through every screen, tapping buttons and following links like a real user.

OpenClawRadar
Four Free Claude Code Skills for Prompt Clarity, Tutorials, and Bug Hunting
Tools

Four Free Claude Code Skills for Prompt Clarity, Tutorials, and Bug Hunting

Four Apache 2.0, no-paid-tier Claude Code skills: prompter (prompt rewriting), tutorial-creator (annotated code walkthroughs), bug-echo (post-fix anti-pattern sweep), and bug-prospector (pre-release audit with 7 analysis lenses).

OpenClawRadar