📚 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),並非越長越好。