The Problem

Claude Code is expensive. Every request ships your system prompt, tool definitions, and conversation history as text tokens. A single dense tool result burns 92,000 tokens.

The Insight

Claude charges image tokens by pixel dimensions, not by how much text is inside.

A 1928x1928 PNG costs 4,761 tokens regardless of content. That same image holds ~92,000 characters of dense code. As plain text, those characters cost ~92,000 tokens.

What pxpipe Does

A local proxy between Claude Code and the Anthropic API. It intercepts requests, renders bulky text into PNGs, then forwards the lighter request.

Gets compressed:

  • System prompt + tool docs (repeated every request)
  • Large tool_result bodies (file reads, command output above ~6k chars)
  • Older conversation history

Stays untouched:

  • Your recent messages
  • Model output
  • Sparse prose (a profitability gate skips when the math doesn't work)

The Numbers

  • Dense tool result: 92,000 tokens to 4,761 tokens
  • End-to-end bill (13,709 requests): $100 to ~$41
  • SWE-bench Lite (n=10): 10/10 both arms, cost from $53.61 to $27.27
  • SWE-bench Pro (n=19): same completion rate, 60% smaller requests
  • Gist recall (decisions, values, paths): 98/98 both arms, zero loss

Fable 5 reads image-rendered content at 100/100 on arithmetic tasks.

The Catch

Lossy. Exact strings (hex IDs, hashes, secrets) are not byte-safe from images.

  • Fable 5 verbatim 12-char hex recall: 13/15
  • Opus: 0/15

Misreads don't throw errors. The model gives a confident wrong answer. For coding tasks this works fine because the agent re-reads files before editing. For exact identifiers, route to a non-allowlisted model as escape hatch.

Model Support

  • Fable 5: Default ON, 100/100 read accuracy
  • GPT 5.6: Default ON
  • Opus 4.7/4.8: Opt-in (~7% error rate)
  • GPT 5.5: Not recommended

Worth Noting

pxpipe logs both compressed and uncompressed token counts per request (.pxpipe/events.jsonl in your home directory), so you can verify savings yourself. One risk: this exploits current pricing. Anthropic could adjust image token pricing anytime.

Credit: @digimaga

GitHub: https://github.com/teamchong/pxpipe