Invisible does not mean free
Trailing whitespace is not visible in your editor and is billed exactly like any other character. Prompts assembled from template literals, indented inside source code, or concatenated across several files accumulate it steadily.
On its own the saving is small. On a system prompt sent on every request by every user, small recurring costs are the ones worth removing, because they compound in a way one-off costs do not.
The line this tool will not cross
It never touches single spaces between words. This is the mistake that turns a whitespace cleanup into a cost increase.
In most byte-pair vocabularies the leading space is part of the word token — the encoder learned " the" as a unit, not "the". Removing spaces between words forces it off those common merges and onto fragments, so the token count goes up while the character count goes down.
Where the whitespace comes from
Template literals in indented code are the usual source: every line of the prompt inherits the indentation of the function it sits in. A prompt indented four levels carries eight spaces on every line, invisibly.
This is worth fixing at the source as well as here — either dedent at build time or keep long prompts in separate files.