Byte pair encoding tokenizer for OpenAI models that encodes text into token IDs, decodes them back, and counts tokens.
-
Updated
Sep 28, 2026 - TypeScript
Byte pair encoding tokenizer for OpenAI models that encodes text into token IDs, decodes them back, and counts tokens.
Exact parallel and streaming tokenization for LLM tokenizers: decides from a tokenizer's definition where its input can be cut, then encodes in parallel or as a stream with token ids byte-identical to sequential encoding. GPT-2, cl100k, o200k and Llama 3, in C++23.
Measured chars/4 against cl100k on 10,000 prompts: 40.5% of rows off by more than 20%, and the error flips sign by content type.
To associate your repository with the cl100k topic, visit your repo's landing page and select "manage topics."