Skip to content
PyRank
  • Search
  • PyPI
  • GitHub
  • Insights
  • Compare
  • Advisories
  • Ecosystem
  • About

Token Optimization Python Packages

Python packages with the GitHub topic token-optimization. Sorted by monthly downloads, with stars and forks.
headroomlabs-ai
headroom-ai

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

418K 81K 6K
jgravelle
jcodemunch-mcp

Symbol-level code retrieval for AI agents: fetch the function you need, not the whole file. Runs locally. 96.2% fewer tokens per lookup on average than grep-and-read on our 15-lookup benchmark. Works with Claude Code, Cursor, Codex and any MCP client. Free for non-commercial use; commercial use needs a one-time license.

158K 3K 378
tokensafe-dev
tokensafe

Your AI agent is smart enough to code all day. Now it actually can. Local runtime firewall & zero-loss context optimizer for AI coding agents.

65K 47 3
jgravelle
jdocmunch-mcp

Documentation retrieval for AI agents: fetch the section you need, not the whole doc. Markdown, RST, AsciiDoc, Jupyter, HTML, OpenAPI and more. Runs locally, works with Claude Code and any MCP client. Free for non-commercial use; commercial use needs a one-time license.

16K 208 50
blackwell-systems
gcf-python

GCF Python implementation. 100% LLM comprehension on every frontier model. 50-92% fewer tokens than JSON. 43B+ round-trips verified. Zero dependencies.

14K 5 0
inth3shadows
terse-mcp

Shrinks your AI agent's tool output so it burns fewer tokens, without changing what the agent reads. Lossless by default, no decode step.

12K 3 1
juyterman1000
entroly-core

Local-first AI efficiency layer for coding agents and LLM apps. Budget and recover context, verify outputs against source, and resume work across agents.

10K 489 75
activeing123
mcptoon

One zero-dependency MCP gateway CLI for every server and agent skill. Token optimization, tool discovery and context compression: 71,929 -> 581 tokens (-99.2%, measured), schemas stay out of context. One config for Claude Code, Codex, Cursor, every agent. 561KB, pure Python. | 零依赖 CLI:管所有 MCP 工具与技能,工具发现省 99.2% token。

10K 446 26
abhijitbansal
cartoon

Token-optimized output for any CLI — your AI agent reads 12 lines instead of 800, raw log always archived. Adapters for pytest/jest/vitest/ruff/eslint/tsc + a compression ladder for everything else.

8K 1 1
0-co
agent-friend

Find the MCP schema issues eating your context window. 156 checks. Grade A+ through F. ESLint for MCP.

7K 4 0
CorvinLabs
corvinos

Self-hosted agentic OS — a Vibe-Engineering platform for Builders. Connect Claude Code Agent to Discord, Telegram, WhatsApp, Slack & Email. EU AI Act 2026 & GDPR compliance by architecture.

7K 26 4
dshakes
distil-llm

Compression with a quality contract — cache-aware, causally-pruned LLM context compression for agentic runtimes, certified non-inferior across 7 domains. Works with any SDK.

7K 21 3
jgravelle
jdatamunch-mcp

Token-efficient MCP server for tabular data retrieval. Index CSV/Excel files, query rows, aggregate — 99%+ token savings vs raw file reads.

6K 85 20
fkiene
llmtrim

Local proxy that compresses your LLM API requests so you pay less, with no change to the answers. Trims wasted tokens from prompts, history, tool output, and code before they're sent: -31% input / -74% output, measured live. Any provider, no extra model calls. Also an MCP server and embeddable library (Rust, Python, Ruby, Kotlin, Swift, JS/TS).

6K 277 24
juyterman1000
entroly

Local-first AI efficiency layer for coding agents and LLM apps. Budget and recover context, verify outputs against source, and resume work across agents.

6K 489 75
ratel-ai
ratel-ai

Ratel SDKs: Rust core, TypeScript and Python SDKs, adapters, rankers, telemetry and the Cloud client

6K 1 1
Stxyu-p
trimtok

Cut token usage in Claude Code, Cursor, Codex & Gemini: deterministic in-process context compression for AI coding agents. Lossless and retrievable (#ref), AST code skeletons, TOON JSON tables, stdio MCP. No LLM, no network, MIT.

5K 2 0
altikva
cgh

cgh, the context graph hub: the project memory of your coding agents. Shared memory across sessions, agents and repos, plus a code and document graph that answers with exact file:line. 62 MCP tools for Claude Code, Codex, Cursor, Gemini and IBM Bob.

4K 0 0
CarlosVallejoRuiz
slurp-graph

Token-budget-aware graph navigation for AI coding agents. Serve exactly the noodles your LLM needs.

4K 47 7
LuminariSoftwares
tool-guardian

Too many MCP servers eating your context? tool-guardian sits in front of all of them and loads each tool’s schema only when needed. A 7-server setup went from 20,005 tokens to 1,084. Any MCP client.

4K 2 0
erayerturk
surgical-context-mcp

🧠 Save 70–95% tokens in Claude Code, Cursor, Windsurf & Cline. Local Tree-sitter code graph MCP server: surgical edit context instead of full-file reads, refactor safety checks, and a hook that blocks large file reads. Reduce token usage & cost, zero LLM indexing.

3K 4 0
rhishi99
agy-headless-bridge

Call the Google Antigravity CLI (agy) headlessly from any non-TTY context — Windows ConPTY + POSIX pty + MCP server. Fixes the empty-output bug (#76).

3K 23 6
elevanaltd
octave-mcp

OCTAVE protocol - structured AI communication with 3-20x token reduction. MCP server with lenient-to-canonical pipeline and schema validation.

3K 53 4
LuminariSoftwares
context-guardian

40 turns: 1,130,722 tokens upstream -> 161,141. A fail-open compaction proxy for local OpenAI-compatible models.

3K 2 0
    • Original data from PyPI, GitHub, and OSV; downloads served through ClickHouse
    • Sources & methodology