📚 Context Window Usage Calculator

Count the tokens in your prompt and expected completion and see how much of the model context window they consume.

📐 计算公式 / 原理
占用率 = (系统提示 + 用户输入 + 预期回复) / 上下文窗口 × 100%;剩余 = 窗口 − 已用
规划对话时把预期回复长度一并计入,避免生成到一半撞上窗口上限被截断。长窗口模型虽标称很大,但注意力成本随长度平方增长,且中段内容容易被忽略(lost-in-the-middle),并非越长越好。