AI Anonymous / Your prompt has a budget / October 10, 2026
Full walkthrough: https://jabsystems.io/ai-anonymous/tiktoken-prompt-budget

Use Python 3.9+ and PowerShell in a new folder. Review count-context.py.
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install 'tiktoken==0.14.0'
.\.venv\Scripts\python.exe .\count-context.py .\context-full.txt .\context-brief.txt --budget 300 --reserve 100
# Exit 2 is expected: at least one file exceeds the 200-token allowance.
.\.venv\Scripts\python.exe .\count-context.py .\context-brief.txt --budget 300 --reserve 100
# Exit 0 is expected: this brief fits the chosen text allowance.

Measured on Windows/Python 3.13.15/tiktoken 0.14.0/o200k_base:
context-full.txt = 396 normalized text tokens; context-brief.txt = 44.
Files are compared as alternatives, not added together. Budget 300/reserve 100 are illustrative.
Text is decoded as UTF-8 (BOM accepted), with CRLF normalized to LF.
Installation and first encoding load require network downloads. The script makes no model requests.
No API key or account is needed. A virtual environment isolates packages, not OS permissions.
Only the top-level package is pinned; transitive dependencies may change.
This is not a full-request token count, billing estimate, model limit, or automatic truncation tool.
No answer quality, speed, savings, real private data, or API token-count endpoint tested.
