dmitry-brazhenko/SharpToken
SharpToken is a C# library for tokenizing natural language text. It's based on the tiktoken Python library and designed to be fast and accurate.
This is a C# library for developers building applications that interact with large language models (LLMs) like GPT or Claude. It takes natural language text and converts it into numerical "tokens" or vice-versa, which is essential for managing input length and processing text efficiently for AI models. Developers working with .NET applications who need to pre-process or post-process text for LLMs would use this.
254 stars. No commits in the last 6 months.
Use this if you are a .NET developer needing to accurately count, encode, or decode text for OpenAI's GPT models or Anthropic's Claude models.
Not ideal if you are not a .NET developer or if you require the most up-to-date and performant tokenizer, as Microsoft.ML.Tokenizers is the recommended future-proof option.
Stars
254
Forks
19
Language
C#
License
MIT
Category
Last pushed
Aug 24, 2025
Commits (30d)
0
Get this data via API
curl "https://pt-edge.onrender.com/api/v1/quality/llm-tools/dmitry-brazhenko/SharpToken"
Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.
Compare
Higher-rated alternatives
aiqinxuancai/TiktokenSharp
Token calculation for OpenAI models, using `o200k_base` `cl100k_base` `p50k_base` encoding.
dqbd/tiktokenizer
Online playground for OpenAPI tokenizers
pkoukk/tiktoken-go
go version of tiktoken
microsoft/Tokenizer
Typescript and .NET implementation of BPE tokenizer for OpenAI LLMs.
lenML/tokenizers
a lightweight no-dependency fork from transformers.js (only tokenizers)