Context7
Up-to-date docs for AI agents
作者提供的说明(英文原文)
MCP server and proxy that compresses LLM prompts, tool output, and replies to cut token cost.
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
选择你使用的 AI 应用,然后复制设置。
你需要
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"llmtrim": {
"command": "npx",
"args": [
"-y",
"@llmtrim/cli",
"mcp"
]
}
}
}在终端中运行这条命令
claude mcp add llmtrim -- npx -y @llmtrim/cli mcp粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"llmtrim": {
"command": "npx",
"args": [
"-y",
"@llmtrim/cli",
"mcp"
]
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"llmtrim": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@llmtrim/cli",
"mcp"
]
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月7日
注册名称已通过 GitHub 账户 fkiene 验证,该账户拥有此仓库
我们还没有从 GitHub 读取这个仓库
我们还没有从 GitHub 读取这个仓库
它在你的电脑上运行,没有互联网端点
在你的电脑上运行,改用本地设置
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
GitHub 仓库最后更新于–,最新版本(0.13.4)于2个月前进入注册中心。
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Node.js。
同一分类中有:Context7, Codebase Memory, Exa
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Up-to-date docs for AI agents
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
llmtrim
Local proxy that compresses LLM API traffic so you pay less. Same answers, smaller bill.
−31% input · −74% output · −66% round-trip cost · 112 live A/B cases · ~5 ms/call · no model to load
Using Claude Code ? One install also gets you /sub to serve it through CLIProxyAPI.
Proxy · CLI · MCP · library (Python · Ruby · Swift · Kotlin · JS/WASM)
What it does • Install • Day to day • In action • Works with • Claude Code • Numbers • Config • CLI & library
You run Claude Code, Codex, Cursor, or your own app. Every turn, the tool sends a large request: system prompt, tools, history, raw command output. You pay for every token of that, including the parts that do not help the model.
A 200-line build log with two errors. Tool schemas resent on every call. JSON with hundreds of near-identical rows. That bulk is still billed.
llmtrim sits on your machine as a local proxy, trims the waste, and forwards a smaller request. The reply is unchanged. You keep the same tools and answers; you spend less.
before: your tool ───── full request ─────▶ OpenAI / Anthropic / …
◀──────── reply ──────────
after: your tool ──▶ llmtrim ──smaller──▶ OpenAI / Anthropic / … (on your machine) ◀──────── reply ────────── (same answer)
Compression cannot raise your bill or break a request; worst case is zero savings. Everything runs locally, nothing is sent to us. In action →
For Claude Code the same install also wires /sub to route sessions through another subscription. Details →
npm install -g @llmtrim/cli@latest && llmtrim setup
llmtrim status
That's it. setup starts a local proxy and wires your shell. When Claude Code is present, it also turns on /sub. You do not run a separate install for that.
| You want | Run |
|---|---|
| First install | llmtrim setup |
| New version | llmtrim update (then llmtrim ensure after npm/brew/cargo) |
| Something broken | llmtrim ensure · llmtrim doctor --fix · or `f` in status |
Any tool that honors
HTTPS_PROXYworks (Claude Code, Codex, Cursor, Aider, your SDK). GitHub Copilot does not (certificate pinning). Full list →
Other installers (Homebrew, curl, Scoop, Cargo, Docker)
# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/fkiene/llmtrim/main/install.sh | sh
irm https://raw.githubusercontent.com/fkiene/llmtrim/main/install.ps1 | iex
brew install fkiene/tap/llmtrim cargo binstall llmtrim scoop install llmtrim docker run -d -p 43117:43117 -v llmtrim-state:/data ghcr.io/fkiene/llmtrim
Full options: INSTALL.md.
Desktop tray (menu bar / system tray)
Menu-bar / system-tray popover with the same savings numbers. Bundled in Homebrew, Scoop, and npm; setup can enable open-at-login. Open with llmtrim tray. On Linux desktops, interactive ensure can fetch the tray binary from the latest release (needs libwebkit2gtk-4.1 and libayatana-appindicator3).
Is this safe?
Same technique as mitmproxy, scoped to LLM API hosts only. setup changes three things; llmtrim uninstall reverses all three:
~/.llmtrim/ (name-constrained; cannot intercept your bank or email)HTTPS_PROXY + CA trustNo API keys stored (your tool's auth is forwarded). Prompts never touch disk; only anonymous token counts. Recoverable tool results stay in bounded daemon RAM for five hours by default and disappear on restart. Full threat model: SECURITY.md.
llmtrim ca
openssl x509 -in ~/.llmtrim/ca.pem -noout -text | grep -A3 "Name Constraints"
llmtrim status # savings + health (aliases: monitor, gain)
llmtrim update # new release, restart daemon, refresh integrations llmtrim ensure # match the recommended install state on this machine
| Situation | Command |
|---|---|
| Watch savings | llmtrim status |
After npm / brew / cargo upgrade | llmtrim ensure (or `f` in status) |
| Diagnose | llmtrim doctor · repair with doctor --fix |
| Pause / resume proxy | llmtrim stop · llmtrim start |
| Force one session through llmtrim | llmtrim wrap claude |
| Remove everything | llmtrim uninstall |
After setup, update, or ensure, owned Claude Code /sub stays in sync with the binary.
Time series: llmtrim status --daily · --weekly · --monthly · --json · --csv.
An agent ran a build. The tool returned 58 lines; two were errors. All 58 would have been billed.
4,662 chars → 978 (−79%). Errors stay verbatim. Repeated INFO lines fold into a template plus the values (lossless when the range is regular).
# before (noise + signal)
[2026-06-13T10:02:00Z] INFO compiling module core::worker::task_0 (incremental) … 28 more near-identical INFO lines … [2026-06-13T10:02:31Z] ERROR src/worker/pool.rs:214: mismatched types: expected usize, found i64 … 25 more INFO lines … [2026-06-13T10:03:01Z] ERROR src/net/conn.rs:88: cannot borrow buf as mutable more than once [2026-06-13T10:03:02Z] INFO build failed, 2 errors
[{}] INFO compiling module core::worker::task_{} (incremental) [×30: (10:02:00Z..10:02:29Z step 1s; 0..29)] [2026-06-13T10:02:31Z] ERROR src/worker/pool.rs:214: mismatched types: expected usize, found i64 [{}] INFO compiling module core::net::conn_{} (incremental) [×25: 10:02:32Z..10:02:56Z; 0..24] [2026-06-13T10:03:01Z] ERROR src/net/conn.rs:88: cannot borrow buf as mutable more than once [2026-06-13T10:03:02Z] INFO build failed, 2 errors
Try it on a request body of your own:
echo '{"model":"gpt-4o","messages":[...]}' | llmtrim compress --provider openai
Log folding is one stage. Others kick in on different waste:
| Waste | What happens |
|---|---|
| Build logs, diffs, grep dumps | Keep errors / changes / matches; fold the rest |
| Long pasted context | Keep chunks relevant to the question |
| Source code | Keep useful bodies; rest → signatures |
| Tool schemas every turn | Trim + keep the cache prefix stable |
| Huge JSON arrays | Compact table (TOON) or sample |
| Verbose model replies | Ask for terser output where safe |
[!IMPORTANT]
Compression cannot raise your bill or break a request. Each stage is re-measured with the provider's real tokenizer and undone if it does not save tokens. If the provider rejects the compressed body, the original is resent. Worst case is zero savings.
Existing prompt-cache prefixes (cache_control) are left alone. First-arrival recoverable shaping (llmtrim recall r_…) is off by default; live-zone tool-output windowing still runs, and a re-run of the same tool ships in full. To skip shaping for a command (verbatim stdout, including a terminal trailer), set toolout_passthrough = ["*gpt.sh*"] or prefix the command with LLMTRIM_TOOL_OUTPUT=passthrough. Lines starting with LLMTRIM_KEEP: survive windowing even when the rest is clipped.
All 10 compressors
Stages run in savings order. Nothing under a cache_control marker is rewritten.
| Stage | What it does | When it runs |
|---|---|---|
| tool-output | Lossless template fold first, then window logs · diffs · grep · dumps down to errors / changes / matches; opt-in first-arrival recall can restore omitted cache-boundary results with llmtrim recall | tool results |
| cache discipline | Mark + stabilize the invariant prefix (sort tools/schema · OpenAI prompt_cache_key) so it stays cached | tools |
| lexical retrieval | BM25+ ranking with RM3 feedback · TextTiling topic cuts · budgeted non-redundant selection; question protected | long context |
| skeletonization | tree-sitter keeps relevant function bodies, drops the rest to signatures (14 languages) | code |
| serialize + hygiene | Minify JSON, encode record arrays to TOON or CSV, Unicode-normalize | always · lossless |
| json sample | Down-sample huge record arrays: first/last + outliers + a query-biased diverse sample | big JSON |
| dedup | Collapse duplicate + near-duplicate lines (prose only) | always |
| output control | Terse instruction · Chain-of-Draft · token budget · native JSON schema · anti-overthink directive (quantized reasoning) · agent-loop frugality directive | auto |
| tool layer | Static tool selection + description trimming | tools |
| multimodal | Downscale images to the provider's resolution cap | images |
Default auto enables each stage only where it pays. safe is lossless-only. Config →
When ~/.claude exists, setup, update, and ensure wire /sub (and routed subagents). No separate install command for that.
| Feature | What you get | ||
|---|---|---|---|
/sub | Per-window: `/sub on [optional:codex\ | kimi\ | grok] · /sub off · /sub status` |
Subscription reroute (sub) (opt-in; may conflict with provider ToS)
Send Claude Code through CLIProxyAPI instead of Anthropic, or as a fallback hop when the current path fails. Login is CLIProxyAPI's TUI; decide for yourself whether that fits the provider ToS.
llmtrim sub on # install + start CLIProxyAPI, enable redirect
llmtrim sub on grok # write opus/sonnet/haiku/fable → that CLI's models llmtrim sub auth # CLIProxyAPI TUI — sign in llmtrim sub models # official + live sidecar models llmtrim sub map on opu
只显示了开头部分;其余内容请在仓库中阅读