Tiktoken
AI & LLMstiktoken is a fast BPE tokeniser for use with OpenAI's models.
Release History
Common Errors
NameResolutionError1 reportThe "NameResolutionError" in tiktoken usually indicates your system can't resolve the OpenAI server's address due to network issues or being offline. To fix this, ensure you have a stable internet connection. If offline use is required, explore local model alternatives like those offered by Hugging Face, as tiktoken fundamentally relies on network access for tokenizer data unless you've specifically cached it beforehand and configured tiktoken to use the cached version.
ConnectionResetError1 reportConnectionResetError in tiktoken often arises from network instability or server-side issues abruptly closing the connection during data transfer. Implement retry logic with exponential backoff when calling `tiktoken.encoding_for_model` or similar functions. This allows your application to gracefully handle temporary network interruptions, increasing the likelihood of a successful connection on subsequent attempts.
MaxRetryError1 reportMaxRetryError in tiktoken usually indicates a failed attempt to download necessary model files, often due to network connectivity issues. To fix this, ensure you have a stable internet connection during the initial use of tiktoken or when new models are required. If offline use is necessary, download the required model files beforehand using `tiktoken.get_encoding()` with a valid internet connection and then specify the local path to the model file directly when initializing the tokenizer.
Related AI & LLMs Packages
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Get up and running with OpenAI gpt-oss, DeepSeek-R1, Gemma 3 and other models.
🦜🔗 The platform for reliable agents.
The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
LLM inference in C/C++
GPT4All: Run Local LLMs on Any Device. Open-source and available for commercial use.
Subscribe to Updates
Get notified when new versions are released