Skip to main content

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"   # 2

Both 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.

Metadata

Release files for toklen 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toklen 0.1.1
File Size Uploaded Provenance
toklen-0.1.1.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for toklen 0.1.1
File Interpreter ABI Platform
toklen-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / toklen-0.1.1.tar.gz

Download URL toklen-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3cb0ae687a0b85c1da8449f9b29d502c3ba73f3b12feffed6a1ab6fc4cdc3134
BLAKE2b-256 checksum
How to use checksums
9aa4fcf23e1ea42fd37f6f5dee841a724fe5265d6fd877ccdd5334e5cc1b4aa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / toklen-0.1.1-py3-none-any.whl

Download URL toklen-0.1.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ce8ffc33e2e9c0bdefe75f1eb80db0981c2438ced795ec15c01c71d7ad10d67
BLAKE2b-256 checksum
How to use checksums
9a1a2a30fb503d059e4fa36146ed4648e3aabf4130a2dbaebc69bab400d1e9fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for toklen 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page