Message History Trimmer
Paste a transcript and preview what four different trimming strategies keep and what they throw away.
10 of 10 messages kept, read from a plain transcript with role: prefixes. 0 tokens dropped — 0.0% of the transcript.
- Messages parsed
- 10
- Full history
- ~242 tokens (est.)
- Per-message overhead applied
- 4 × 10 = 40 tokens
- Messages kept
- 10 of 10
- Kept
- ~242 tokens
- Dropped
- ~0 tokens · 0.0%
usage object on an actual API response: that is what you are billed on, and it includes chat-template wrapping this model cannot see. Each message is charged its own content plus the per-message overhead you entered, because chat APIs wrap every message in role markers and template tokens that never appear in the text you wrote — the default of 4 is a plausible example, not a provider’s published figure, and the only way to get the real one is to compare two requests’ usage. Trimming is done on whole messages: no strategy here cuts a message in half, because half an assistant turn is worse than none. The summary strategy reserves the tokens but does not write the summary — generating one is a model call, and this page never makes one.What survives — dropped messages are struck through
You are a travel assistant. Be concise and never invent prices.
I'm going to Lisbon in October for four days. Where should I stay?
Most first-time visitors stay in Baixa or Príncipe Real. Baixa is central and flat; Príncipe Real is quieter and has the better food. Both are walkable to the tram.
Quieter, please. What about getting from the airport?
The metro red line runs from the airport into the centre and takes about twenty minutes. Taxis and ride-hailing are available outside arrivals.
Is four days enough to also see Sintra?
Yes. Sintra is a forty-minute train ride from Rossio and works as a day trip. Go early; the palaces queue badly after mid-morning.
What's the weather like then?
October in Lisbon is usually mild with some rain. Pack a light jacket and something waterproof.
Back to the hotel question — what was the quieter neighbourhood again?
Every trimming strategy loses something specific
A conversation is billed by re-sending it. Turn twenty pays for turns one through nineteen again, so history is the one part of a chat application whose cost grows without anyone changing anything. Trimming is not optional at length; the only decision is what to throw away.
Keeping the last N messages is the simplest rule and the one that breaks most visibly: the instruction the user gave in turn two — “always answer in French”, “I’m allergic to shellfish” — falls out of the window and the assistant contradicts itself. Fitting a token budget newest-first is the same strategy with better economics, since long messages cost more of the budget than short ones, and it has the same failure. Keeping the opening and the recent tail is the usual production answer: it costs a little more and it preserves the setup turns where users state their constraints. Reserving room for a summary is the honest version of “we’ll summarise the old turns” — it charges you for the summary before you have written it, which is the part people forget when they budget.
Two things the preview cannot show. Dropping a message does not remove its influence: the assistant’s later replies were written with it in context, so the transcript stays internally consistent for a while after the evidence has gone. And what fits is not what works — models attend less reliably to the middle of a long history, so a trimmed conversation sometimes answers better than the full one. If accuracy matters more than cost, test both.