pxpipe
Local proxy that cuts Claude Code token bills 59–70% by re-rendering bulky context — system prompts, tool docs, and collapsed history — as compact PNGs, exploiting the fixed image-token cost of Fable 5's vision channel.
Overview
pxpipe is a local MITM proxy that cuts Claude Code's input token bill by rendering bulky context — system prompts, tool docs, and older collapsed history — as compact PNGs before each request leaves your machine. An image's token cost is fixed by its pixel dimensions, not by how much text is inside it. Dense content (code, JSON, tool output) packs ~3.1 chars per image-token vs ~1 char per text-token on real Claude Code traffic. The proxy intercepts /v1/messages, rewrites eligible bulk into image blocks behind a per-request profitability gate, and forwards — responses stream normally. A live dashboard at 127.0.0.1:47821 shows tokens saved, text→image conversions side-by-side, and a kill switch. Recent turns always stay text; only the static prefix and older bulk history are imaged.
The Verdict
Who Should Use pxpipe?
Best For
- Claude Code users on Fable 5 with token-dense workloads (code, JSON, logs)
- Teams running long sessions with large system prompts and tool docs
- Developers who want measurable, per-request cost accountability via events log
- Projects where 59–70% end-to-end token savings justify some lossiness on imaged content
Not Ideal For
- Workflows requiring byte-exact recall of hex strings, IDs, or secrets from context (lossy by design)
- Opus 4.8 users — misread rate ~7% on rendered pages, opt-in only
- Sparse-prose workloads (~3.5 chars/token) where text wins on cost
- Teams needing zero added request latency (PNG encoding adds time before forwarding)
What's Great
- 30-second setup:
npx pxpipe-proxy+ one env var points Claude Code at it - 59–70% end-to-end bill reduction measured across all requests, not just compressed ones
- Savings measured honestly: free
count_tokensprobe on each original request, compared against actually-billed usage, no double-counting of cache discounts - Fable 5 reads imaged context at 100/100 on novel arithmetic and 98/98 on gist recall benchmarks
- SWE-bench Lite pilot: 10/10 both arms at −65% request size
- Profitability gate — sparse prose stays text, images only when math wins
- MIT licensed, TypeScript, usable as a library without the proxy
Watch Out For
- Lossy by design: verbatim 12-char hex recall drops to 13/15 on Fable 5, 0/15 on Opus — silent confabulation, not hard errors
- PNG encoding adds latency to large requests before they leave your machine
- Opus 4.8 and GPT 5.5 are deliberately opt-in — both read imaged content measurably worse
- Workload-dependent: wins on token-dense content, loses money on sparse prose
- Rendering research paused as of 2026-07-05 — verbatim misreads are capacity-bound, not solvable by layout tweaks
Pricing
View all features & details
What Gets Compressed
- Large
tool_resultbodies (file reads, command output, logs) above ~6k chars of token-dense content - Older collapsed history: turns behind the live tail re-rendered as image pages
- Static system prompt + tool docs slab
- Everything else passes through byte-identical (messages, recent turns, model output)
Benchmarks (Fable 5)
- Novel arithmetic (N=100): 100% accuracy, −38% tokens
- Gist recall with distractors (15k–45k char sessions, N=98/arm): 98/98 both arms
- State tracking (N=18/arm): 18/18 both arms
- Confabulation on never-stated facts (N=16/arm): 0/16 both arms
- SWE-bench Pro: 14/19 ON vs 15/19 OFF at −60%, 18/19 verdicts agree
Model Scope
- Default:
claude-fable-5andgpt-5.6 - Opus 4.8 and GPT 5.5: opt-in via
PXPIPE_MODELSor dashboard (measurably worse at reading renders) PXPIPE_MODELS=offdisables imaging entirely- Subagents on non-allowlisted models pass through as text
Technical Details
- 1928px-wide columns, ~92,000 chars/page, ≈4,761 vision tokens per image
- Prompt caching preserved: static prefix splice kept cache-friendly
- Events log at
~/.pxpipe/events.jsonl— per-request counterfactual and actual tokens - Library mode:
renderTextToImages/transformAnthropicMessagesfor direct integration - Pure-JS runtime (Node and edge/Workers);
@napi-rs/canvasbuild-time only
How It Compares
| Feature | pxpipe | Token Optimizer | Context Mode | Manual Compaction |
|---|---|---|---|---|
| Approach | Image compression proxy | Context pruning plugin | Selective context | Manual /compact |
| Token Savings | 59–70% end-to-end | Workload-dependent | Workload-dependent | Session-dependent |
| Setup | 30 seconds, one command | Plugin install | Toggle flag | Manual trigger |
| Lossiness | Imaged content (manageable) | None | None | None |
| Accuracy Measured | Per-request counterfactual | Aggregate | Estimate | None |
| Model Scope | Fable 5, GPT 5.6 (default) | All | All | All |