Count the tokens used by a multi-turn conversation and see what share of the model context window they occupy, so you know when to trim or compress history.
接近上限时需截断或总结历史。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Token accounting | input plus output tokens must stay within the context limit | Model documentation |
| Length conversion | English runs about four characters per token and Chinese one to two per character | Tokenizer documentation |
| Overflow handling | overflow is truncated or rejected, so summarise or chunk long chats | Model documentation |