Skip to content
Code Recycle
Free Β· open sourceMITUnclaimed listing

tokenx is by johannschopplich β€” not by us.

We indexed this project so people can find it. We are not selling it, we host no copy of the code, and we are not affiliated with or endorsed by its authors β€” get it from them.

Indexed Oct 5, 2026 Β· 179 stars at index time. Maintainers: claiming verifies your identity and unlocks a higher assurance tier. Removal requests are honored.

Application Β· for humans & their agents

tokenx

unclaimed listingactively maintainedFreeMIT

πŸ“ Fast token estimation with 95%+ average accuracy in a 2kB bundle

by Open Source Community Β· New publisher

Go to the project β†—

Every claim on this page is refundable if it is untrue β€” refund policy.

πŸ“ Fast token estimation with 95%+ average accuracy in a 2kB bundle

johannschopplich/tokenx is an open-source project by johannschopplich: πŸ“ Fast token estimation with 95%+ average accuracy in a 2kB bundle. Indexed here so it can be found β€” not resold.

It is free. Get it from the upstream repository: https://github.com/johannschopplich/tokenx

From the project's own README (excerpt, reproduced for discovery under its MIT license):

tokenx

Fast and lightweight token count estimation without requiring a full tokenizer.

Estimates are calibrated against OpenAI's o200kbase encoding – the tokenizer of all current GPT models. Counts for other LLM families will differ somewhat; the defaultCharsPerToken and languageConfigs options let you tune the heuristics for your model. For precise counts, use a full tokenizer like gpt-tokenizer.

Features β€’ ⚑ 95%+ average accuracy, and no single sample below 90% β€’ πŸ“¦ Just 2kB bundle size with zero dependencies β€’ πŸ–₯️ Bundled CLI – count, slice and split from the shell β€’ 🌍 Multi-language support with configurable language rules β€’ πŸ—£οΈ Built-in rules for accented scripts (German, French, Spanish, Slavic), Cyrillic, and Greek β€’ πŸ€„ CJK (Chinese, Japanese, Korean) character handling β€’ πŸ˜€ Emoji-aware pricing (emoji cost more tokens than their character count suggests)

Benchmarks

The following chart shows how close the estimates come to actual GPT token counts for different input texts:

Bars grow left when tokenx underestimates and right when it overestimates. The axis spans the Β±10% per-sample deviation bound.

Accuracy depends on the kind of text, not its length: a short excerpt deviates about as much as the full document it came from. A holdout corpus that no ratio was ever fitted against is held to a looser Β±15% bound, so a retune cannot silently overfit the chart.

Three cases are knowingly outside these bounds, all underestimates: β€’ High-entropy strings – base64, hashes, digests: β‰ˆ-70%. Pricing them would cost every caller runtime for a case ordinary traffic rarely carries. β€’ Traditional and classical Chinese – the hanzi rate is calibrated on contemporary simplified script: β‰ˆ-10% to -20%. β€’ Scripts without a built-in rule – Arabic β‰ˆ-35%, Hindi β‰ˆ-30%,…

01Capabilities

Does

  • No capabilities recorded

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet β€” be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality β€” security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm β€” weight comes from verified usage, not vote count.

Nobody has reported anything yet β€” a success counts as a report too.

04Trust Passport

Full passport β†’
–/100

0/0 automated components pass. An automated score is never a security guarantee.

This listing is unclaimed, so publisher identity cannot be verified and it stays below the β€œverified” tier by design β€” that is a statement about the listing, not about the project’s quality. Our automated scans still ran; a maintainer who claims it unlocks identity verification.

VersionChannelReleasedNotes
0.0.0stableOct 5, 2026Indexed listing β€” see the upstream repository for real release history.