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

js-tiktoken

JavaScript implementation of OpenAI's tiktoken for counting and encoding tokens.

Prompts, structured output and evals npm MIT

Used in agent projects
5
0.1% of 4,818 JS/TS repos built with AI coding agents; 59 counting our dependency samples
Gid Score
51 /100
#1381 of 3,794 tools, #18 in prompts, structured output and evals · ranking
Rank in prompts, structured output and evals
#19 of 72
by use in those projects
Downloads
5.7M
npm, last 7 days, js-tiktoken
GitHub stars
1,073
82 forks · last push Aug 9, 2025

How js-tiktoken is used

js-tiktoken is a dependency in 5 of the 6,208 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 2,661, Ethereum and EVM 1,496, 3D and games 2,818, agent frameworks and SDKs 10,983); counting those, it appears in 59 projects, and what it is used with below comes from all of them. The most used alternative in our scan is GPT Tokenizer (14 projects). Projects that use it most often also use Zod (76.3%), AI SDK (47.5%), Anthropic SDK (37.3%).

js-tiktoken popularity over time

Top tools by Gid Score

js-tiktoken: downloads per weeknpm, js-tiktoken 5,727,981
js-tiktoken: GitHub starsdqbd/tiktoken 1,073

Gid Score 51: downloads 80, use in agent projects 43, GitHub stars 13, downloads trend 63 (each 0-100). How it is calculated.

Often used with js-tiktoken

Zod76.3% of js-tiktoken projects · 3.0× more than average
AI SDK47.5% of js-tiktoken projects · 10.8× more than average
Anthropic SDK37.3% of js-tiktoken projects · 10.0× more than average
react-markdown37.3% of js-tiktoken projects · 9.5× more than average
TypeScript89.8% of js-tiktoken projects · 1.6× more than average
OpenAI35.6% of js-tiktoken projects · 7.8× more than average
remark-gfm25.4% of js-tiktoken projects · 7.0× more than average
OpenTelemetry23.7% of js-tiktoken projects · 16.9× more than average

From all 59 projects in our scan that use js-tiktoken, including the dependency samples.

Install

Packagenpm install js-tiktoken
Main stacksTypeScript / JavaScript (43), Next.js (14), Python (2)
Example projectsEKKOLearnAI/ekko-studio, fdarkaou/open-deep-research, taracodlabs/aiden, ryoiki-tokuiten/Deepthink, supermemoryai/memorybench

Alternatives to js-tiktoken

All prompts, structured output and evals

Tools that do the same job, so a project picks one or the other. Add-ons and libraries used alongside js-tiktoken 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
tokenx npm · new in the catalog
Fast token count estimates for LLM prompts in a 2 kB bundle.
37 2 (0.0%) 1.5M 185 MIT

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

Is js-tiktoken right for your project? Ask AgentGid →