teamchong/pxpipe

cut Claude Code token usage by rendering text context as images

What it solves

pxpipe is a local proxy that reduces the cost and token consumption of AI agents (specifically Claude Code) by converting bulky text context—such as system prompts, tool documentation, and old chat history—into compact PNG images. Because image token costs are based on pixel dimensions rather than text length, dense content can be packed more efficiently, leading to significant reductions in end-to-end billing (reported as 59–70% lower in some workloads).

How it works

It operates as a local proxy between the user's agent and the AI provider. It intercepts requests and rewrites eligible bulk text blocks into image blocks based on model-specific rendering profiles.

  • Profitability Gate: It only images content where the token savings outweigh the cost of image tokens.
  • Selective Rendering: It targets large tool results, older history, and static system prompts/tool docs, while keeping recent turns and sparse prose as text.
  • Model Profiles: It uses specific geometries and fonts (e.g., Spleen for Claude, JetBrains Mono for others) to optimize legibility for different models.
  • Factsheet: To mitigate the lossy nature of vision, it preserves a limited number of precision-critical tokens (like IDs or hashes) as text alongside the images.

Who it’s for

Developers using AI agents (like Claude Code, Cursor, or Codex) who handle large amounts of context and want to lower their API costs and increase the effective capacity of their context window.

Highlights

  • Significant Token Reduction: Can increase effective context capacity by 4.7x to 5.3x for certain models.
  • Local Proxy: Easy setup via npx pxpipe-proxy and pointing the ANTHROPIC_BASE_URL to it.
  • Offline Export: Ability to render text or git diffs to PNGs for manual upload to image-capable clients.
  • Lossy but Effective: Acknowledges that exact string recall (like hex strings) is not 100% byte-safe, but maintains high performance on arithmetic and general gist recall.
  • Dashboard: Includes a live dashboard to track tokens saved and view text-to-image conversions.

相關

  • Dispatch
  • 專案
  • 專案
  • 專案
  • 專案