pxpipe
cut Claude Code token usage by rendering text context as images
pxpipe is a Claude Code plugin that cuts token costs by 59–70% by rendering bulky text context—system prompts, tool documentation, and conversation history—as compact PNG images before sending requests to Anthropic's API. It exploits the fact that image tokens are priced by pixel dimensions rather than content density, packing approximately 3.1 characters per image token versus 1 character per text token. The plugin runs as a local proxy that developers point their Claude Code client to, transparently compressing requests while streaming responses normally. It works with multiple vision-capable models including Claude Fable 5, Opus 5, Gemini 3.6 Flash, and GPT 5.6 Sol, with model-specific rendering profiles optimized for each.
Key Features
Use Cases
- 01Reducing API bills for long coding sessions with extensive file reads and command outputs in Claude Code
- 02Compressing multi-file context when working on large codebases where tool results exceed cache limits
- 03Extending effective context windows by 4–5× to fit more conversation history and documentation in the same token budget
- 04Batch processing dense logs, JSON responses, or structured data through vision-capable models at lower cost
- 05Exporting complex codebases or diffs as visual context for sharing with team members using image-upload AI clients
- 06Running long SWE-bench style agent tasks where accumulated history would otherwise fill the context window
Related Plugins
View moreandrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
claude-mem
Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
rtk
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
pxpipe — FAQ
What is pxpipe and how does it reduce Claude Code token usage?+
pxpipe is a local proxy that intercepts Claude Code API requests and converts bulky text context (system prompts, tool docs, old conversation turns) into compact PNG images before sending them to Anthropic. Image tokens cost a fixed amount based on pixel dimensions regardless of text density, enabling ~3.1 chars/token versus ~1 char/token for regular text, resulting in 59–70% lower API bills.
How do I install and use pxpipe with Claude Code?+
Run 'npx pxpipe-proxy' to start the proxy on port 47821, then launch Claude Code with 'ANTHROPIC_BASE_URL=http://127.0.0.1:47821 claude'. Alternatively, use 'pxpipe warp -- claude' to route traffic without setting environment variables. The dashboard at http://127.0.0.1:47821 shows live savings and controls.
Which AI clients and models work with pxpipe?+
pxpipe works with Claude Code, Cursor, Codex, and any client that can point to a custom API base URL. Supported models include Claude Fable 5 (default), Claude Opus 5, Google Gemini 3.6 Flash, GPT 5.6 Sol, and Grok 4.5, each with optimized rendering profiles.
Is pxpipe lossy and will it break my code?+
Yes, it is lossy—exact 12-character hex strings in dense imaged content score 13/15 on Fable 5 versus 0/15 on weaker models, and misses are silent confabulations. Recent turns and open tool calls stay as text, and byte-exact work should route to non-allowlisted models as an escape hatch. SWE-bench testing shows 10/10 identical results on both plain and pxpipe arms.
Do I need an API key or is pxpipe free to use?+
pxpipe itself is free and MIT-licensed, but you still need your own Anthropic (or OpenAI/Google) API key since the proxy forwards requests to the real provider. Savings are measured against your actual API usage and billed tokens.
Can I use pxpipe without the proxy for manual image exports?+
Yes, run 'npx pxpipe-proxy export src/' or pipe text via stdin to render content as PNG pages in an offline export folder. Upload the generated PNGs to any image-capable AI client like Cursor when you want dense visual context without running the proxy.
How do I install pxpipe?+
Open the source repository on GitHub and follow its README. pxpipe is a plugin — MCP Agents Market links you directly to the official repo.
Is pxpipe free?+
pxpipe is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.