Skip to content
 
 

Repository files navigation

the tanuki-context logo: a pixel-art tanuki in a straw hat

tanuki-context

Pay pixels, not tokens. Bulky text enters the model as dense PNG pages, at a fraction of the price.

npm CI zero dependencies license

AI models charge for every token they read. tanuki-context turns the bulky parts of a conversation — logs, command output, long documents — into compact PNG pages the same model reads for a fraction of the price. Node >= 18 or a static Rust binary, zero dependencies either way.

It is just how pricing works: text costs about 1 token per 4 characters; an image costs a fixed amount set by its pixel size, no matter how much text is drawn inside it. Pack 28,000 characters into one 1568x728 page and the model reads it for 1,456 tokens instead of ~7,000. pxpipe found how far that gap stretches; tanuki packages it so the model itself decides when to use it, plus a proxy mode for clients you can't change.

a rendered page: dense 5x8-pixel text, 312 columns of system log

What you save

Measured on a 200 KB slice of a real system journal (identifiers rewritten; repetition and every error line untouched). Reproduce with npm run tiers.

how the log enters the conversation tokens saved
pasted as raw text 51,200 0
drawn as image pages 10,752 -79%
noise removed first, then drawn 5,264 -90%
plus codebook and tiny font 2,576 -95%

Every row is one command on your own file — estimate is instant, renders nothing, and says so when plain text would be cheaper:

npx tanuki-context estimate your.log 0 --distill --codebook --font tiny

Try it in 30 seconds

claude mcp add tanuki-context -- npx -y tanuki-context

Any MCP client: { "command": "npx", "args": ["-y", "tanuki-context"] }. Or price a file with no client at all — --cached flips the verdict when the text would ride the prompt cache:

npx tanuki-context estimate big.log 0 --model claude-opus-4 --cached

When not to reach for it

  • Your model can't read images. Hard requirement (any current Claude qualifies).
  • The exact bytes must survive. Secrets and credentials are auto-refused — never imaged. Dense random strings can misread silently, so the verbatim sidecar ships uuids/hashes/ids as text; edit-targets should stay text.
  • The content is small, or your bill is output-dominated. tanuki_stats reports the output share so you can tell.
  • You're not on Anthropic pricing. Pass model to tanuki_estimate for provider-correct cost (OpenAI tiles, Gemini tiles), overridable via TANUKI_RATES.

New in 0.9

  • Recency-tiered proxy (--recency N, or TANUKI_RECENCY): recent turns stay text and are reasoned over precisely; only distant bulk is imaged (VIST slow-fast routing).
  • Credential gate: any block carrying an API key, private-key block, or token is never rendered to pixels — a documentation warning turned into a guarantee.
  • Lean surface: tools/list advertises 3 tools by default (TANUKI_ALL_TOOLS=1 for all 7); brief tool descriptions by default (TANUKI_TOOL_VERBOSE=1 for the full contracts).

More

  • Full manual — three run modes, the seven tools, stash/fetch, the table knob, benchmarks, internals.
  • Design notes — why each pipeline stage exists.
  • Evals — we publish the harness, not a number: needles (read-back fidelity, results published), paired (cost per successful task), taskqual (task success on pages vs text).
  • Research roadmap — how tanuki maps onto DeepSeek-OCR, Glyph, and VIST.

Rust: cargo install --git https://github.com/Osyna/tanuki-context --branch rust — the same engine as one static binary, held byte/pixel-exact with the npm package by a parity harness.

MIT. The bundled glyph atlas derives from the Spleen font, GNU Unifont, and pxpipe — see NOTICE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages