Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
PxPipetoken cost reductionClaude Code token savings

PxPipe: How Turning Context Into Images Cuts Coding Agent Costs

PxPipe is an open-source proxy that renders coding agent context as images to cut input token bills, but only some models can actually read the pages.

Edited by Luis Chavez-Mattos, Director of Product RSS
PxPipe: How Turning Context Into Images Cuts Coding Agent Costs

What is PxPipe?

PxPipe is an open-source, MIT-licensed proxy that sits between your coding agent and your model provider, rewriting bulky text context into rendered images before the request goes out. It runs locally, has picked up roughly 7,600 GitHub stars, and works with tools like Claude Code, the Antigravity CLI, Open Code, Codex, and OMP. The pitch is simple: providers charge for images based on pixel size, not character count, and a page of dense text rendered as a PNG can cost far fewer tokens than sending the same content as plain text.

TL;DR

  • PxPipe is a local proxy that converts large chunks of coding agent context into PNG images before sending requests to the model provider, then lets responses stream back as normal text.
  • The core trick exploits a token economics mismatch: on real Claude Code traffic, one image token can hold about 3.1 characters of dense code or JSON versus roughly one character per text token.
  • It only compresses specific content: the static system prompt and tool docs, large tool results above about 6,000 characters, and older chat history, while recent turns and your own messages stay as plain text.
  • Measured results on Claude Opus 5 showed 59 to 70% lower end-to-end bills, and a demo task that cost about $42 in plain Claude Code finished around $6 using PxPipe.
  • Not every model can actually read the compressed images. The project’s own benchmark shows Gemini models and the original Opus 5 reading nearly perfectly, while Opus 5.5 and Sonnet 5.5 badly misread dense text, sometimes hallucinating plausible-looking but wrong answers instead of erroring out.
  • PxPipe ships a dashboard, per-model kill switches, and an offline export mode so you can inspect exactly what got imaged and control which models receive images at all.

Remy AI Engineer Certification

Your seat is open. Leave certified.

Build and deploy an app for enterprises with AI in one live afternoon. No coding.

How does PxPipe actually save tokens?

The mechanism relies on a quirk in how vision and text tokens are priced. A text token typically maps to about one character of dense code or JSON. But when that same content gets rendered as a page of small pixel text (PxPipe uses a font around 25 by 8 pixels, with a banner header and arrow markers standing in for line breaks) and sent as an image, each image token can represent roughly three times as many characters. Pack more information per token, and the token count drops even though the underlying content hasn’t changed.

In one example cited by the project, about 48,000 characters of system prompt and tool documentation came out to roughly 25,000 tokens as plain text, but the same content rendered as a single image page cost around 2,700 image tokens. That’s close to a 10x reduction on that specific chunk, though the overall bill savings are smaller once you include response tokens and cached reads, which PxPipe never touches.

PxPipe doesn’t image everything indiscriminately. It targets three categories: the large, mostly static block of system prompt and tool docs, big tool outputs like file reads or long command results above roughly 6,000 characters, and older turns in the chat history. Your most recent exchanges and anything you type yourself stay as text, which keeps the agent responsive and avoids compressing the parts most likely to need precision.

How much does it actually save in practice?

The headline numbers come from testing against Claude Opus 5. End-to-end bills, meaning the full session cost including output tokens and cache reads that the proxy doesn’t compress, dropped by 59 to 70%. A side-by-side demo running the same task showed a plain Claude Code session ending near $42 with its context window 96% full, versus a PxPipe-routed session finishing around $6 while using only about 73,000 of a 1 million token context budget.

The project also ran benchmark suites. On Steer UE Bench Light, both the plain-text and PxPipe-routed agents solved all 10 tasks, with PxPipe using about 65% fewer tokens per request. On the harder Steer UE Bench Pro, PxPipe solved 14 of 19 tasks versus 15 of 19 for plain text, at roughly 60% lower token usage. That’s a small sample, and the project is upfront about it, but it suggests the compression doesn’t badly damage task completion even when the model is reading its own history from rendered images rather than raw text.

To back up the savings claims, PxPipe sends the original, uncompressed request to the provider’s token-counting endpoint for every call and logs that figure next to what you were actually billed. Both numbers land in a local events file, so the savings aren’t just asserted, they’re auditable against your own usage.

Which models can actually read the compressed images?

Developers have their tools. Enterprises have Remy.
Developers · AI coding tools
Claude Code
Codex
Cursor
GitHub Copilot
Enterprises · built into Remy
⌂Self-hosted
✓SOC 2
✚HIPAA
☰Audit log

This is the part that matters most if you’re deciding whether to use PxPipe at all, and it’s also where the project is unusually candid. Not every model can parse small, dense pixel text reliably. The test used to measure this hides 15 random hex IDs inside log images and checks whether the model can read them back exactly.

Results varied sharply. Gemini models performed best, with the top Gemini model reading all 15 IDs correctly and the Flash variant getting 14 of 15. The original Opus 5 model read 13 of 15. But newer Claude models performed worse: Opus 5.5 managed only 3 of 15, and Sonnet 5.5 got just 2. Some Opus point releases also dropped off before PxPipe compensated by adding extra pixel spacing between rows, which brought accuracy back up to 14 and 13 respectively for those versions.

Based on this, PxPipe sorts models into tiers. Full readers, meaning Gemini and the original Opus 5, handle the images reliably enough to trust exact details. Gist readers, including Opus 5.5, understand the general content and can do arithmetic over it but shouldn’t be trusted with exact IDs or numbers pulled from an image. And a third list of models, including Haiku 5.5, Sonnet 5.5, and several other current models, are flagged as not suitable for imaging at all right now.

What happens when a weak model misreads an image?

The failure mode is the part worth paying attention to. When a model that can’t reliably read the compressed text encounters one, it doesn’t throw an error or flag uncertainty. It produces a confident, plausible-sounding answer that may simply be wrong. The project’s own documentation describes a real instance where a model recalled a person’s name from imaged chat history and got it wrong with full confidence. The underlying reason is that these models aren’t doing OCR in a strict sense. They’re inferring content from visual patterns, so when the pixels are ambiguous, the model fills the gap with a statistically likely guess rather than admitting it can’t tell.

A concrete example: in the font PxPipe uses, a zero and an eight differ by a single pixel, and even the best-performing model occasionally misread a zero as an eight in a request ID. PxPipe’s workaround is to send a small plain-text “fact sheet” alongside the image containing exact IDs and numbers, which the model can cross-check against what it reads visually. In coding sessions this risk is lower because agents typically re-read a file before editing it, but for pure chat recall or pulling exact values out of logs, it’s a real limitation to keep in mind.

How do you set up and use PxPipe?

Starting the proxy is a single command: npx pxpipe-proxy starts it locally and also serves a dashboard for inspecting activity. To route an agent through it, you use a wrap command, prefixing your normal agent launch command, for example wrapping Claude Code, the Antigravity CLI, or Open Code. It also supports Codex and OMP. Because the wrap approach only intercepts specific provider routes rather than rewriting your base URL, things like OAuth logins and remote connectors in your existing agent setup keep working without extra configuration. If your agent talks to a custom local gateway, you can add a route rule to point PxPipe at that port too.

The enterprise platform for building software with AI.
Vendor Risk Portal✓ SOC 2✓ HIPAA✓ Audit log
VendorsApprovalsContractsReportsSettings
Active vendors1,284
In review37
High risk6
VendorTierRiskApprovalNEW
Northwind SupplyTier 1LowApproved
Acme LogisticsTier 2MediumApprove
Helios DataTier 1HighPending
Granite FreightTier 3LowApproved
Pinecrest LabsTier 2LowApprove
You → RemyAdd an approval step for new vendors

The dashboard shows token savings, a side-by-side view of every text-to-image conversion, and toggle switches to turn imaging on or off per model, essentially a manual kill switch. By default it images Opus 5, Opus 5.5, and Gemini models. There’s also an escape hatch for precision work: sub-agents running on models not on the approved list pass through as plain text automatically, so you can send exact-match tasks to an untrusted model while your main session stays compressed.

For workflows without a persistent proxy, there’s an offline export mode that writes a folder containing the rendered image pages, a fact sheet, a manifest, and a prompt file, which you can upload manually to any image-capable tool. A companion stats command reads the local events log and prints a report on compression, latency, and savings, even when the proxy itself isn’t running.

Is PxPipe worth using?

If you’re running Gemini models or the original Opus 5, the case is strong: these models read the compressed pages with high accuracy and the token savings are substantial. If you’re on Opus 5.5, it can still cut costs in a typical coding session where the agent re-verifies file contents through tool calls, but you should avoid relying on it for tasks where exact strings or numbers matter. If you’re on Sonnet, Haiku, or most current open-weight models, the project itself currently advises against imaging context for those models.

The transparency here is a genuine strength. Most token-saving approaches only show you the savings on the piece they touch. PxPipe publishes the full bill, including the parts it doesn’t compress, and maintains an explicit list of which models fail its own reading test. The tradeoffs are a small latency cost from rendering images and the fact that model compatibility isn’t static. Opus 5.5 reads worse than its predecessor, which means the safe list can shift with each new model release.

Frequently Asked Questions

What does PxPipe actually compress?

It targets three types of content: the static system prompt and tool documentation block, large tool outputs like file reads or command results above roughly 6,000 characters, and older chat history. Recent conversation turns and user-authored messages are left as plain text.

Does PxPipe change the model’s output?

No. It only rewrites the request going to the provider. Responses stream back as normal text with no changes on the output side.

Which models should not be used with PxPipe right now?

According to the project’s own testing, models including Haiku 5.5, Sonnet 5.5, and several other current models performed poorly enough on image-reading tests that the documentation recommends not imaging context for them at all.

Does image compression break prompt caching?

No, and this is deliberate. On Anthropic’s API, PxPipe preserves the prompt cache boundary so that images don’t change on every turn, which would otherwise erase the cache discount and increase costs instead of lowering them.

Can I try PxPipe without running it as a live proxy?

Yes. It includes an offline export mode that writes a folder of rendered image pages, a fact sheet, and a prompt file for a given source directory or piped text, which you can upload manually to any tool that accepts images.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.