aiqinxuancai/TiktokenSharp
Token calculation for OpenAI models, using `o200k_base` `cl100k_base` `p50k_base` encoding.
This is a C# library that helps developers accurately count tokens for text processed by OpenAI's large language models like GPT-3.5 and GPT-4. It takes a model name or encoding identifier as input, along with your text, and outputs the precise token count. This tool is for C# developers building applications that integrate with OpenAI APIs and need to manage token limits effectively.
126 stars.
Use this if you are a C# developer building an application that interacts with OpenAI models and you need a reliable way to calculate token counts for pricing, input limits, or response length management.
Not ideal if you are working in a programming language other than C#, or if you do not directly integrate with OpenAI's API.
Stars
126
Forks
18
Language
C#
License
MIT
Category
Last pushed
Feb 22, 2026
Commits (30d)
0
Get this data via API
curl "https://pt-edge.onrender.com/api/v1/quality/llm-tools/aiqinxuancai/TiktokenSharp"
Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.
Related tools
pkoukk/tiktoken-go
go version of tiktoken
dqbd/tiktokenizer
Online playground for OpenAPI tokenizers
microsoft/Tokenizer
Typescript and .NET implementation of BPE tokenizer for OpenAI LLMs.
lenML/tokenizers
a lightweight no-dependency fork from transformers.js (only tokenizers)
tryAGI/Tiktoken
This project implements token calculation for OpenAI's gpt-4 and gpt-3.5-turbo model,...