teamchong/pxpipe
cut Claude Code token usage by rendering text context as images
What it solves
Coding agents send large amounts of text context (system prompts, tool docs, conversation history) on every request. This consumes tokens and drives up costs, especially with dense content like code, JSON, and logs. pxpipe addresses this by recognizing that an image's token cost is fixed by pixel dimensions, not text content. It packs roughly 3.1 characters per image-token versus about 1 character per text-token on real Claude Code traffic, achieving 4.8–5.3× text capacity on supported models.
How it works
pxpipe runs as a local proxy that intercepts requests to provider APIs. For each request, it identifies bulky parts—the system prompt, tool documentation, and older turns—and rewrites them into a single dense PNG image (using a bitmap font like Spleen 5×8). The image is sent to the model instead of raw text, while recent turns stay as text. The proxy never touches the model's output; it only compresses the request. It also includes a text factsheet for certain models to help disambiguate fine pixel details like 0 vs 8. The proxy automatically selects profiles for supported models (e.g., Gemini 4, Claude 3.6/3.8 Flash, claude-fable-5) and can be configured per model. A dashboard shows token savings and provides a kill switch.
Who it's for
Developers and teams who use coding agents like Claude Code, OpenCode, Antigravity CLI, or Gemini CLI and want to reduce token-related costs without losing model performance. It suits workloads with token-dense content—code, JSON, logs—where the compression wins; it is not recommended for sparse prose where text is more efficient. Users must run models that can accurately read dense images (e.g., Gemini 4, claude-fable-5) to get full benefits; some later Claude models regress on pixel reading and are handled with a gist-only profile or excluded.
Highlights
- ~59–70% lower end-to-end bills on
claude-fable-5(10/10 SWE-bench Lite, 14/19 SWE-bench Pro). - 4.8–5.3× text capacity per same window when reading through images.
- 15/15 dense hex and 100/100 arithmetic on Gemini 4 Argon (pure-image).
- 30-second setup:
npx pxpipe-proxythenpxpipe warp -- claude(oragy,omp, etc.). - Offline export to PNGs for use without a live proxy.
- Honest model tiers: full-fidelity readers (Gemini 4, Gemini 3.x Flash,
claude-fable-5) vs gist-only vs unsupported—with a profitability gate and escape hatches.
Related
- Dispatch
- Project
- Project
- Project
- Project