an21an21

Tokentrimmer — Development skill for Claude Code

Development community

Local proxy that losslessly shrinks tool output in Claude Code / Anthropic / OpenAI requests before they're sent.

How to install Tokentrimmer

This entry records only its repository, not the path inside it, so there is no exact command to give. Open an21an21/tokentrimmer and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Tokentrimmer does

Local proxy that losslessly shrinks tool output in Claude Code / Anthropic / OpenAI requests before they're sent. Verified, prompt-cache safe, zero dependencies.

Alternatives in Development

  • Breach Check — HIBP k-anonymity check on a password wordlist 4.5k ★
  • Claude Code Proxy — Run Claude Code on OpenAI models 3.3k ★
  • Dario — A local OpenAI- and Anthropic-compatible proxy that brings your Claude Pro/Max subscription to Cursor, Cline 485 ★

README

TokenTrimmer

[![npm](https://img.shields.io/npm/v/tokentrimmer)](https://www.npmjs.com/package/tokentrimmer) [![license: MIT](https://img.shields.io/npm/l/tokentrimmer)](LICENSE) ![dependencies: 0](https://img.shields.io/badge/dependencies-0-brightgreen)

![TokenTrimmer: a local proxy that losslessly compresses tool output, e.g. a JSON array becomes a table](docs/social-preview.png)

**Reduce Claude Code token usage and LLM API cost, without losing information.** TokenTrimmer compresses tool output (JSON, logs, grep results, repeated file contents) in every request before it reaches the Anthropic or OpenAI API, and keeps prompt caching working. Works with Claude Code and Codex.

A local proxy that sits between your app (Claude Code, Codex, the Anthropic or OpenAI SDK, any agent) and the API, and makes each request smaller before it is sent, without changing what the model can read. Zero dependencies, Node 18+, runs on your machine.

your app  ->  TokenTrimmer (127.0.0.1:8787)  ->  api.anthropic.com / api.openai.com / chatgpt.com (Codex)

What it does

In an agent session, most of the input tokens are tool output: JSON from APIs, command logs, grep results, the same file or page fetched twice. The whole conversation is sent again on every turn, so that output is paid for over and over. TokenTrimmer rewrites tool results into a shorter form as each request passes through:

  • Lossless by default. JSON is minified, arrays of objects become compact tables, log lines that share a pattern store the pattern once, grep output is grouped by directory, and a result or block of lines the model already saw earlier becomes a one-line reference to it. Every encoding has a decoder, and a built-in verifier decodes each rewritten result before the request is sent. If any check fails, the original request goes out unchanged.
  • Only tool results are touched. System prompts, tool definitions and the conversation text are sent as is. Results from file tools