Prompt length optimizer
A prompt you call thousands of times is paying for every token on every request. Most prompts carry dead weight — pleasantries, restated rules, hedging — that adds cost without changing the output. This tool splits your prompt into sentences, scores each one for how much instructional intent it actually carries, and lets you trim the low-value lines while watching the token savings add up live.
The economics of prompt length
The cost argument is straightforward: every input token is billed on every API call. A system prompt that runs 1,000 tokens costs more per call than one that runs 600 tokens, and when a product fires that prompt tens of thousands of times per day, the difference is measurable. But cost is only one reason to care about length.
Shorter prompts are also often more reliable. A 2,000-token system prompt stuffed with restated rules and cautionary hedges can confuse a model more than a tight 500-token version with the same essential instructions. Long prompts push later instructions toward the “lost in the middle” zone where attention is weaker, and they make it harder to spot conflicts or redundancies.
How it works
Scoring is a transparent local heuristic, not a hidden model call. Each sentence earns points for the signals that drive model behavior — imperative verbs (“return”, “format”, “never”), explicit constraints, formatting rules, examples, and concrete nouns — and loses points for filler like politeness, hedging, and restated context. The result is a ranked list: high-scoring sentences are load- bearing, low-scoring ones are candidates for the cutting-room floor. Toggle a sentence off and the live token count shows exactly what you saved.
What typically gets cut
| Low-value pattern | Example |
|---|---|
| Politeness openers | ”Please make sure to always…” |
| Restated context | ”As we discussed, your role is to…” |
| Redundant hedging | ”If possible, try to…” |
| Over-explained constraints | Three sentences saying what one would say |
| Preamble to the preamble | ”Before we begin, note that…” |
Tips and notes
- Trim bottom-up. Start with the lowest scores; those are almost always filler.
- Watch for short, high-stakes lines. “Output JSON only” scores modestly by length but is critical — judgement still beats the heuristic.
- Re-test after trimming. The optimizer estimates intent; only real inputs confirm the shortened prompt still behaves. Run a few before shipping.
- Biggest wins are in high-volume prompts — a system prompt fired on every request is where saved tokens compound into real money.
- Pair with the token budget planner to see how trimming frees room for additional context or longer outputs within the same context window.