toklen
v0.1.1
Published
Count tokens with a model's real Hugging Face tokenizer
Maintainers
Readme
toklen
Count tokens with a model's real Hugging Face tokenizer. Prints an integer.
npx toklen openai-community/gpt2 "hello world" # 2
uvx toklen openai-community/gpt2 "hello world" # 2Both commands always print the same number. Node uses
@huggingface/tokenizers,
Python uses the Rust tokenizers bindings. One
dependency each, no transformers, no PyTorch.
toklen Qwen/Qwen3-8B < README.md # stdin
git diff | toklen openai-community/gpt2
toklen -s google-bert/bert-base-uncased "hello world" # 4, with [CLS] and [SEP]toklen --help covers the flags. docs/usage.md has the library API and
the counting rules. npm ·
PyPI · MIT.
