Open-source tool shows system prompt and tools can eat 98% of API tokens
behrouzbk · reddit · 2026-11-07
The author open-sourced tokensaver (MIT, offline) to break down each LLM API call into system prompt, tool schemas and user message with token counts and cost per 1k calls. On his sample support bot, the fixed part was 98–99% of every request.
bash
pip install prompt-tokensaver
tokensaver request --system system.md --tools tools.json --user "a typical user message"
- --tools accepts OpenAI/Anthropic tool JSON or a full request body
- --json output for CI
A companion screenshot shows tokensaver optimize trimming a prompt by 32 tokens (42.1%), saving $80 per 1M calls on gpt-4o.
More from coding & agent
- LLM agent re-architects models during training: algorithmic reasoning 55%→84%, AIME 64%→71% — lateinteraction · 2026-11-07
- AI won't replace designers: a deep dive into the Quest team's AI iOS design workflow — JiliJeanlouis · 2026-11-07
- Developer stumbles into an accidentally recursive SKILL.md that tests itself — holdenmatt · 2026-11-07
- Anthropic details agent memory: "dreaming" helps Claude fix mistakes and organize knowledge — RLanceMartin · 2026-11-07
- TechSEO Connect talk: write SOPs as skills and use small commits when vibe coding — lilyraynyc · 2026-11-07
- Conductor AI agent orchestrator shuts down, alternatives compared — vikvang1 · 2026-11-07