Skip to content
Agents tracked: 440 Downloads (7d): 202M down 19.5% GitHub stars: 10.4M Releases (7d): 607 Agent status: all upSince last limit reset: Claude 28d · Codex 0d Updated Oct 21, 2026

tokenx

Fast token count estimates for LLM prompts in a 2 kB bundle.

Prompts, structured output and evals npm MIT

Used in agent projects
2
0.0% of 4,818 JS/TS repos built with AI coding agents
Gid Score
37 /100
#2892 of 3,794 tools, #56 in prompts, structured output and evals · ranking
In the catalog because
Public numbers
downloads and GitHub stars, added Oct 13, 2026; too rare in our project count to rank by use
Downloads
1.5M
npm, last 7 days, tokenx
GitHub stars
185
8 forks · last push Oct 16, 2026

How tokenx is used

tokenx joined the catalog on its public numbers (1,472,263 downloads a week on npm and 185 GitHub stars), not on our project count: it is a dependency in 9 public GitHub projects of our scan, 2 of them set up for AI coding agents. The most used alternative in our scan is GPT Tokenizer (14 projects). Projects that use it most often also use Vitest (100.0%), Zod (100.0%), Model Context Protocol SDK (JavaScript) (88.9%).

tokenx popularity over time

Top tools by Gid Score

tokenx: downloads per weeknpm, tokenx 1,472,263
tokenx: GitHub starsjohannschopplich/tokenx 185

Gid Score 37: downloads 67, use in agent projects 16, GitHub stars 0, downloads trend 63 (each 0-100). How it is calculated.

Often used with tokenx

Vitest100.0% of tokenx projects · 4.9× more than average
Zod100.0% of tokenx projects · 4.0× more than average
Model Context Protocol SDK (JavaScript)88.9% of tokenx projects · 9.4× more than average
Day.js88.9% of tokenx projects · 60.6× more than average
i18next88.9% of tokenx projects · 70.7× more than average
Lucide React88.9% of tokenx projects · 4.4× more than average
partial-json88.9% of tokenx projects · 613.1× more than average
PDF.js88.9% of tokenx projects · 64.9× more than average

Install

Packagenpm install tokenx
Main stacksNext.js (6), TypeScript / JavaScript (3)
Example projectslobehub/lobehub, vual/lobe-chat-pro, 1600822305/AetherLink, liukailun007/PLC-Studio, MingyiSecLab/Mingyi-Atlas

Tools that do the same job, so a project picks one or the other. Add-ons and libraries used alongside tokenx are not listed here; they are in "Often used with".

Tool Gid Score Used in agent projectsDownloads / wk GitHub starsLicense
GPT Tokenizer npm
JavaScript BPE tokenizer with pricing and token counts for OpenAI models.
44 14 (0.3%) 1.2M 855 MIT
tiktoken (JavaScript) npm
JavaScript/WASM bindings for OpenAI's tokenizer for token counting.
43 10 (0.2%) 806K 1,073 MIT
js-tiktoken npm
JavaScript implementation of OpenAI's tiktoken for counting and encoding tokens.
51 5 (0.1%) 5.7M 1,073 MIT

More in Prompts, structured output and evals: Ultracite tiktoken (Python) tokenizers LangSmith Langfuse (Python) TokenLens @graphql-codegen/typescript-operations partial-json

Is tokenx right for your project? Ask AgentGid →