Tokcost — zero-dependency CLI for exact LLM token counts (hand-rolled BPE)

240 · Users Rust Lang · Aug. 2, 2026, 6:47 p.m.
Summary
The blog post introduces 'tokcost', a zero-dependency command-line interface (CLI) tool designed for counting tokens and estimating costs for large language models (LLMs) text using a hand-rolled byte pair encoding (BPE) algorithm. The author explains their motivation for creating a standalone binary without runtime dependencies, details their design choices regarding the pretokenization process, and encourages feedback on their approach. The repository for 'tokcost' is available on GitHub.