AI 工具AI TOOLS· CHAT-AGENT
jia-gao/leanctx
一个直接替换 OpenAI 客户端的提示压缩库,不改代码就能省 40-60% token 费用。Drop-in prompt compression for production LLM apps that cuts token costs by 40–60% with no code changes.
根据公开文档整理,未运行实测;费用以项目官网为准。Based on public documentation, without runtime testing. Check the project site for pricing.
能力CAPABILITIES
节省40-60%的token费用
不修改代码直接替换OpenAI等客户端
自动区分代码/散文选用不同压缩方式
用本地模型或自选模型压缩长文本
通过HTTP服务让非Python程序也能用
Wrap OpenAI, Anthropic, or Gemini clients with one import change
Route code and errors untouched, prose compressed automatically
Run offline benchmarks to measure exact token savings
Serve compression over HTTP for non-Python callers
Track compression metrics with OpenTelemetry
上手GET STARTED
pip install leanctx # core (passthrough only — useful for testing the wrapper)选择与你的环境对应的方式。命令来自项目文档,未运行实测。Choose the option for your environment. Commands come from project documentation and have not been run-tested.
使用限制LIMITATIONS
以下要求与风险来自文档静态检查,未执行项目代码;扫描没有命中,不代表使用安全。Risk here is evidence, not an alarm. These findings come from static scanning of the docs; we never execute a project’s code.
限制LIMITS
未知Unknown
项目动态PROJECT ACTIVITY
首次发现FIRST SEEN
03 OCT 202603 OCT 2026
增长GROWTH
-0.9%-0.9%
326 → 323 stars · 14 个快照326 → 323 stars · 14 snapshots
状态STATUS
持续活跃Active
可减少 40-60% 的 token 成本,且无需修改代码,直接替换包名即可LLMLingua-2 local compression loads ~1.2 GB of model weights once, then runs free per call
静态扫描STATIC SCAN
在 README、SKILL.md 和依赖清单中没有匹配到已知风险模式。No known risk patterns matched in the README, SKILL.md or dependency list.
静态扫描未发现明显风险,但不代表安全The static scan found no known risky patterns in the documentation, but that does not guarantee the code is safe — review the source before using in sensitive environments.
{
"agents": [
{
"agent": "claude-code",
"evidence": "readme: …Coding agents — Cursor-like / Claude-Code-like, with growing tool-call…"
}
],
"apiKey": "workload rag # live API, set ANTHROPIC_API_KEY leanctx bench run longbench-v2 --worklo",
"docker": null,
"taxonomy": {
"scores": {
"design": 0,
"ai-tools": 10,
"dev-tools": 0,
"indie-web": 0,
"skill-agent": 0,
"productivity": 0
},
"primary": "ai-tools",
"secondary": "chat-agent"
},
"localRuntime": "ed-data). Open-source models, runs locally, MIT-licensed. Your prompts and user da",
"skillMdTotal": 0,
"skillMdErrors": [],
"treeTruncated": false,
"categoryScores": {
"data": 1,
"agent": 0,
"media": 0,
"design": 0,
"browser": 0,
"devtool": 0,
"security": 0,
"marketing": 0,
"productivity": 0
},
"classification": [
{
"signal": "description mentions AI",
"weight": 0.2
}
],
"scannedSources": [
"readme"
],
"skillMdFetched": 0
}