Count the tokens in your prompt and expected completion and see how much of the model context window they consume.
超出上限需截断或摘要历史。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Hard limit | prompt plus completion tokens are bounded by the context window | Model documentation |
| Cost | billing charges input and output tokens separately | Model documentation |
| Trimming strategy | keep system prompts and recent turns, summarise older ones | Prompt engineering practice |