omni-compression
它能做什么
这项技能展示如何在提示词发给模型之前把它压缩,使用命令输出和文本压缩两种模式。适合想降低令牌用量并先测试效果的人。
适用场景
- ✓当用户想减少发送给模型的令牌数量的时候。
- ✓当用户想预览压缩会如何改变某个提示词的时候。
- ✓当用户想添加语言包或自定义压缩规则的时候。
技能链接
https://github.com/cheaper-inference/OmniRoute/blob/release/v3.8.53/skills/omni-compression/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“开启之前,请先预览一下压缩能让这段提示词缩短多少。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能列出预览压缩、比较结果,以及列出语言包和压缩规则的调用。它涵盖用于命令输出的 RTK 模式、用于文本的 Caveman 模式,以及把两者组合起来的叠加模式。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Overview
Configure RTK (command output), Caveman (prose), and stacked compression modes. Manage language packs, custom rules, and test prompt compression reducing tokens by 60–90%.
Authentication
All requests require a valid Bearer token or session cookie. Obtain a token via POST /api/auth/login or configure REQUIRE_API_KEY=false for local development.
Endpoints
POST /api/compression/preview
Preview compression for a message payload
curl -X POST http://localhost:20128/api/compression/preview \
-H "Authorization: Bearer $OMNIROUTE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
GET /api/compression/language-packs
List Caveman compression language packs
curl http://localhost:20128/api/compression/language-packs \
-H "Authorization: Bearer $OMNIROUTE_TOKEN"
GET /api/compression/rules
List Caveman compression rule metadata
curl http://localhost:20128/api/compression/rules \
-H "Authorization: Bearer $OMNIROUTE_TOKEN"
POST /api/compression/compare
POST compression › compare
curl -X POST http://localhost:20128/api/compression/compare \
-H "Authorization: Bearer $OMNIROUTE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
POST /api/compression/compare/verify
POST compression › compare › verify
curl -X POST http://localhost:20128/api/compression/compare/verify \
-H "Authorization: Bearer $OMNIROUTE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
GET /api/compression/engines
GET compression › engines
curl http://localhost:20128/api/compression/engines \
-H "Authorization: Bearer $OMNIROUTE_TOKEN"
POST /api/compression/retrieve
POST compression › retrieve
curl -X POST http://localhost:20128/api/compression/retrieve \
-H "Authorization: Bearer $OMNIROUTE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Payloads
See the full OpenAPI specification at GET /api/openapi/spec or docs/openapi.yaml for detailed request/response schemas.
OmniRoute — Compression
Requires OMNIROUTE_URL and OMNIROUTE_KEY. See entry-point SKILL for setup.
Overview
OmniRoute compresses token payloads before forwarding to providers. No code changes required — set it once, it applies to all requests transparently.
| Engine | Best for | Typical savings |
|---|---|---|
| RTK | Terminal / build / test / git output | 60–90% |
| Caveman | Human prose, chat history | 46% input |
Stacked (rtk → caveman) |
Mixed coding sessions | 78–95% |
| MCP accessibility filter | Browser/accessibility tool results | 60–80% |
Get current settings
curl $OMNIROUTE_URL/api/settings/compression \
-H "Authorization: Bearer $OMNIROUTE_KEY"
Enable RTK (best for coding agents)
curl -X PUT $OMNIROUTE_URL/api/settings/compression \
-H "Authorization: Bearer $OMNIROUTE_KEY" \
-H "Content-Type: application/json" \
-d '{ "mode": "rtk", "enabled": true }'
Enable stacked mode (maximum savings)
curl -X PUT $OMNIROUTE_URL/api/settings/compression \
-H "Authorization: Bearer $OMNIROUTE_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "stacked",
"enabled": true,
"stackedPipeline": ["rtk", "caveman"]
}'
Enable Caveman (prose / chat)
curl -X PUT $OMNIROUTE_URL/api/settings/compression \
-H "Authorization: Bearer $OMNIROUTE_KEY" \
-H "Content-Type: application/json" \
-d '{ "mode": "standard", "enabled": true }'
Caveman intensities: lite (safe), standard (balanced), aggressive (long sessions), ultra (context recovery).
Preview compression before enabling
curl -X POST $OMNIROUTE_URL/api/compression/preview \
-H "Authorization: Bearer $OMNIROUTE_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "rtk",
"text": "$ npm test\n> jest\n\nPASS src/a.test.ts (2.1s)\nPASS src/b.test.ts (1.8s)\n..."
}'
Response incl
常见问题
什么是 RTK 压缩?
这项技能把 RTK 描述为处理命令输出的模式,而 Caveman 负责处理文本。
它能减少多少令牌?
这项技能描述的减少幅度大约为 60% 到 90%。
我能比较压缩前后的结果吗?
可以。这项技能有一个比较调用,可以返回某段数据的压缩结果。
详情
作者的原始描述
Configure RTK (command output), Caveman (prose), and stacked compression modes. Manage language packs, custom rules, and test prompt compression reducing tokens by 60–90%.
热度
- GitHub 星标
- 84k
- 排名
- #1425
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …