🔶 Show HN:用于降低 Codex/Astra 成本的 Token 压缩 CLI
英文标题:🔶 Show HN: Token compression CLI to save Codex/Astra costs
Yolanda 和 Spencer 发布了一款面向编程 Agent 的 Token 压缩 CLI,称其可将 Codex 的工具调用输出 Token 减少 29.6%,在上下文密集型任务中最高可节省约 30% 成本。该工具通过代理和微调后的 Qwen 模型,在工具调用结果返回模型前进行压缩,同时尽量保持 Agent 轨迹与 KV Cache 不受影响。CLI 可免费使用,作者也为希望将其集成到产品中的团队提供 SDK 和 API 密钥。该项目主要针对编程 Agent 而非对话式 Agent,并声称采用 ZDR,不会保留用户查询。
43 B
中文
大家好,HN!Yolanda 和 Spencer 在此——我们想分享一款为自己打造的 Token 压缩工具,它帮助我们将 Codex 成本降低了 30%!
在用尽订阅额度、每人每天在 API 上烧掉 700 美元后,我们微调了一个压缩模型,用于精简 Codex 的工具调用输出,从而减少输入 Token 和缓存成本。它将 Token 数量降低了 29.6%,现在我会默认在 Codex 中启用它。
为了避免影响缓存,我们使用代理层加上经过微调的 Qwen 模型;该模型经过训练,能够在工具调用结果返回给模型之前将其移除,同时保留 Agent 的执行轨迹,让 KV Cache 保持不变。
这款 CLI 对所有人免费开放使用(https://github.com/spenmcke/compress)。欢迎告诉我们你的反馈,以及进一步削减 Astra 成本的技巧!如果你希望将它集成到产品中,以较低成本提供最好的模型,我可以为你提供 SDK 和 API 密钥。
附言:它是为编程 Agent 而非对话式 Agent 构建的。我针对文件检索准确率、轨迹保留和输出质量进行了优化;根据任务对上下文的依赖程度,最高可实现 30% 的成本降低。
在安全和隐私方面,它是一个封装本地 Codex 的代理,并采用 ZDR,因此不会保留任何查询。它在 Codex 中默认启用;当你不想进行压缩时,可以使用 codex --uncompress 将其禁用。
欢迎试用:代码位于 https://github.com/spenmcke/compress
你可以使用以下命令安装 CLI:
curl -fsSL <https://install.everestagi.com/install.sh> | sh && source ~/.config/everest/shell.sh
非常期待听到大家的反馈,也想了解你们那些节省 Token 成本的实用小技巧!
English / 原文
Hey HN! Yolanda and Spencer here - wanted to share a token compression tool that we’ve built for ourselves to save 30% costs on codex!
After maxing out sub and burning $700/day per person on api, we fine tuned a compression model to trim codex's tool call output to reduce input token + cache. It cut down tokens by 29.6% and now I just leave it on by default in Codex.
To avoid messing up w/ cache, we use proxy + fine tuned qwen model trained on preserving agent trajectory to remove tool call results before they go back to the model, leaving kv cache untouched.
The cli is free for everyone to use (https://github.com/spenmcke/compress). Just lmk ur feedback and hacks to shave even more costs on astra! If you want to integrate it into your product to offer the best models at low cost, I can set you up with an sdk and api keys
PS: It’s built for coding agents, not conversational agents. I optimized it for file retrieval accuracy, trajectory preservation, and quality to get up to 30% cost reduction depending on how context-heavy the task is.
On security and privacy side, it's a proxy wrapping your local codex and ZDR so it doesn't retain any queries. It’s on by default in codex and when you don’t want compression, you can use codex --uncompress to disable it.
Give it a try: code is in https://github.com/spenmcke/compress
You can install the cli using
curl -fsSL <https://install.everestagi.com/install.sh> | sh && source ~/.config/everest/shell.sh
Love to hear any feedback and learn your hacky ways to save token costs too!