tiktoken is a fast BPE tokeniser for use with OpenAI's models.
Browse cluster: HTML Parsing & Error Tracking →tiktoken is a fast byte pair encoding tokenizer built for use with OpenAI's language models. Written in Python and available via PyPI, it provides APIs for encoding text into tokens and decoding tokens back to text, with performance reported to be 3-6x faster than comparable open source tokenizers. The project includes an educational submodule for learning about BPE mechanics and supports extension through both direct instantiation of Encoding objects and a plugin mechanism via namespace packages.