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"

A companion screenshot shows tokensaver optimize trimming a prompt by 32 tokens (42.1%), saving $80 per 1M calls on gpt-4o.

Original post →

More from coding & agent

coding & agent channel →