Item detail
github.com

jia-gao/leanctx

jia-gao/leanctx is a drop-in prompt compression for p that RepoRadar is tracking in its MIT drop-in prompt-compression library for produ section, currently rated Gold tier with a 'try now' verdict. Its strongest signal is workflow potential, scored 9.1 out of 10.

Score8.0
Popularity309.0
Risklow
TierGold
Score breakdown
Usefulness8.0
Novelty8.0
Momentum6.0
Maturity8.8
Open-source/build8.4
Evidence7.2
Workflow potential9.1
Setup ease8.8

Popularity is tracked separately. Support, ads, sponsorships, and tips never affect these signals.

Why it matters

Useful for AI engineering teams that need to cut LLM API costs without changing their application code: jia-gao/leanctx is the MIT drop-in prompt-compression library that replaces `from openai import OpenAI` with `from leanctx import OpenAI` (same interface, compressed requests) and transparently compresses long prompts via LLMLingua-2 before sending them to the upstream API; for engineering teams

Who should use it

AI engineering teams that need to cut LLM API costs without changing their application code: jia-gao/leanctx is the MIT drop-in prompt-compression library that replaces `from openai import OpenAI` with `from leanctx import OpenAI` (same interface, compressed requests) and transparently compresses long prompts via LLMLingua-2 before sending them to the upstream APIEngineering teams that need Anthropic and Gemini coverage (the project ships matching `leanctx[anthropic]` and `leanctx[gemini]` adapters, so the same compression layer covers all three major commercial APIs)AI product builders who want a per-call `usage.leanctx_tokens_saved` and `usage.leanctx_ratio` field on every response — the measurement is in the response, so the caller can build cost dashboards directlyRAG and long-context applications that hit token-budget limits on long document chunks, conversation histories, or tool outputs — the 40-60% measured token reduction on LongBench v2 short subset is the headline cost-savingEngineering teams that need per-call configuration (mode on/off, threshold_tokens to skip compression on short prompts, routing to send prose through LLMLingua-2 only) — the library does not force compression on every callUsers who want a privacy-preserving default (open-source models run locally, MIT-licensed, prompts and user data never leave the user's infrastructure by default) — the library is the right default for sensitive applicationsAI engineering teams that need a fallback to passthrough (the library falls back to passthrough when LLMLingua-2 is not installed, so the library does not break the application if the compression dependencies are missing) — the fallback is the right safety netTeams evaluating prompt-compression libraries (run leanctx on a fixed long-context set, measure `usage.leanctx_tokens_saved` against the cost of LLMLingua-2 inference, compare to naive head+tail truncation) — the LongBench v2 numbers are the eval surface

Who should skip it

Pass on jia-gao/leanctx if its scope or audience does not match what your team is building right now.

About this signal

jia-gao/leanctx is tracked by RepoRadar as a drop-in prompt compression for p in the MIT drop-in prompt-compression library for produ section. It was first seen on 2026-06-25 and last updated on 2026-06-25. The current verdict is 'try now' with a Gold tier and easy setup difficulty. jia-gao/leanctx leads on workflow potential (9.1) and maturity (8.8); its lowest signal is momentum (6.0), so factor that in before investing setup time. This page summarizes the evidence RepoRadar has captured from captured source metadata. The score, tier, risk label, and verdict on this page are never influenced by sponsorship, ads, or tips — they reflect only the usefulness, popularity, novelty, momentum, maturity, and evidence signals described in the RepoRadar methodology.

How this item is evaluated

RepoRadar assigned jia-gao/leanctx a composite score of 8.0 out of 10, placing it in the Gold tier. This score combines weighted sub-signals: usefulness (35%), novelty (18%), momentum (14%), maturity (10%), open-source/build quality (7%), evidence quality (6%), workflow potential (6%), and setup ease (4%). Popularity is tracked separately at 309.0 and never affects the composite score or tier. The risk label of 'low' reflects inherent user-impacting hazards, not generic novelty. Items with no risk flag may still require normal code review before production use.

Putting this into practice? Read How to evaluate an AI tool before you adopt it for the checklist behind this score.

Risk explanation

**First LLMLingua-2 call loads ~1.2 GB of model weights to `~/.cache/huggingface/`.** The README explicitly calls this out: 'First Lingua call loads ~1.2 GB of model weights to `~/.cache/huggingface/`. Subsequent calls reuse the cache. Add `pip install 'leanctx[lingua]'` to opt in; without it, leanctx falls back to passthrough.' Users running on disk-constrained environments or air-gapped systems should plan for the 1.2 GB weight download and the local inference cost of the compression step.; **Compression has a per-call latency cost.** The compression step adds latency on top of the upstream API call; the trade-off (token savings vs. added latency) is per-call and the user should measure both on their representative workloads before turning compression on for all calls. The `trigger.threshold_tokens` config is the right knob to skip compression on short prompts where the latency cost exceeds the token savings.; **The LongBench v2 numbers are the maintainer's measurements.** The README reports that 'On the public LongBench v2 leaderboard's short subset, leanctx-Lingua doubles accuracy versus naive head+tail truncation (40 % vs 20 %) while removing 57 % of tokens' — these numbers are reproducible from the open-source code, but users running leanctx in production should validate on their own representative datasets, not just the LongBench v2 short subset..

Evidence links

Closest alternatives / related signals

jia-gaoleanctxprompt-compressioncompressionllmlinguallmlingua-2linguaopenai