TiktokenSharp 1.0.0

TiktokenSharp

"Due to the lack of a C# version of cl100k_base encoding (gpt-3.5-turbo), I have implemented a basic solution with encoding and decoding methods based on the official Rust implementation.

Currently, only cl100k_base has been implemented. Other encodings will be added in future submissions. If you encounter any issues or have questions, please feel free to submit them on the lssues."

Start

using TiktokenSharp;
TikToken tikToken = TikToken.EncodingForModel("gpt-3.5-turbo");
var i = tikToken.Encode("hello world"); //[15339, 1917]
var d = tikToken.Decode(i); //hello world

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
1.2.0 7 11/26/2025
1.1.8 120 08/14/2025
1.1.7 21 06/03/2025
1.1.6 4 06/06/2025
1.1.5 4 06/06/2025
1.1.4 4 06/06/2025
1.1.2 4 06/06/2025
1.1.1 4 06/28/2025
1.1.0 4 06/06/2025
1.0.9 5 06/28/2025
1.0.8 4 06/28/2025
1.0.7 4 06/28/2025
1.0.6 4 06/28/2025
1.0.5 4 06/28/2025
1.0.4 4 06/28/2025
1.0.3 4 06/28/2025
1.0.2 4 06/28/2025
1.0.1 4 06/06/2025
1.0.0 4 06/06/2025