What stop sequences do
A stop sequence tells the API to halt generation the moment a given string appears. It is the cheapest way to prevent a model from rambling past the answer you wanted, and it is under-used because the behaviour is easy to get subtly wrong.
The sequence itself is typically not included in the returned text, which surprises people parsing the output for it.
What you are billed for
Tokens generated before the stop. Generation halts at that point, so nothing is produced afterwards — which is precisely why a well-chosen stop sequence saves real money on a verbose model.
This is the opposite of trimming after the fact. Truncating in your own code costs you the full generation; stopping at the source does not.
Choosing one that works
It must be a string the model will actually produce, and never one it might produce inside a valid answer. A double newline is a common choice for single-paragraph answers and a poor one for anything multi-paragraph.
For structured output, a closing delimiter you specified in the prompt is usually ideal — you told the model to end with it, so it is both predictable and unambiguous.