VOOZH about

URL: https://www.nuget.org/packages/TokenFlow.AI

โ‡ฑ NuGet Gallery | TokenFlow.AI 0.8.1


๏ปฟ

๐Ÿ‘ Image
TokenFlow.AI 0.8.1

dotnet add package TokenFlow.AI --version 0.8.1
 
 
NuGet\Install-Package TokenFlow.AI -Version 0.8.1
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TokenFlow.AI" Version="0.8.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TokenFlow.AI" Version="0.8.1" />
 
Directory.Packages.props
<PackageReference Include="TokenFlow.AI" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TokenFlow.AI --version 0.8.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TokenFlow.AI, 0.8.1"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TokenFlow.AI@0.8.1
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TokenFlow.AI&version=0.8.1
 
Install as a Cake Addin
#tool nuget:?package=TokenFlow.AI&version=0.8.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

<p align="center"> <img src="https://github.com/AndrewClements84/TokenFlow.AI/blob/master/assets/logo.png?raw=true" alt="TokenFlow.AI" width="500"/> </p>

TokenFlow.AI

๐Ÿ‘ Build
๐Ÿ‘ Docs
๐Ÿ‘ codecov
๐Ÿ‘ NuGet Version
๐Ÿ‘ NuGet Downloads
๐Ÿ‘ Buy Me A Coffee


๐Ÿ’ก Overview

TokenFlow.AI is a lightweight .NET library for tokenization, chunking, and cost estimation across modern large language models (LLMs) such as OpenAI GPT-4o, Anthropic Claude, and Azure OpenAI.

It provides accurate token counting, intelligent text splitting, cumulative usage tracking, and real-time cost estimation for any AI-driven application.
Now includes CLI utilities, developer documentation, full Flow.AI ecosystem integration, and automated performance benchmarking.


๐Ÿงฉ Key Features

  • ๐Ÿ”ข GPT-style token counting for .NET
  • ๐Ÿงฑ Smart text chunking with configurable token limits and overlap
  • ๐Ÿ’ฐ Real-time cost estimation for prompt and completion usage
  • ๐Ÿงฎ TokenUsageTracker โ€” track cumulative token and cost usage across analyses
  • ๐Ÿงฉ Unified TokenFlowClient โ€” analyze, chunk, and cost in one API
  • โš™๏ธ CLI utilities (TokenFlow.Tools) โ€” positional arguments for simplicity (tokenflow cost "text" gpt-4o)
  • ๐Ÿ“˜ Developer documentation site โ€” API reference + usage guides via GitHub Pages
  • ๐Ÿงพ Benchmark suite powered by BenchmarkDotNet and integrated with CI
  • ๐Ÿ”Œ Pluggable tokenizer providers โ€” including OpenAI tiktoken, Claude cl100k_base, and Approx fallback
  • ๐Ÿ”— Flow.AI.Core integration โ€” exposes ITokenFlowProvider for shared usage across Flow.AI ecosystem projects
  • ๐Ÿ’ฌ CLI v3.0 alignment โ€” enhanced cost commands, dynamic pricing, and Flow.AI registry integration
  • ๐Ÿง  Dual targeting for .NET Standard 2.0 and .NET 8.0

๐Ÿง  Quick Examples

Model-specific tokenizers:
using TokenFlow.Tokenizers.Factory;

var factory = new TokenizerFactory();
var gptTokenizer = factory.Create("gpt-4o");
var claudeTokenizer = factory.Create("claude-3-opus");

Console.WriteLine($"GPT tokens: {gptTokenizer.CountTokens("Hello world!")}");
Console.WriteLine($"Claude tokens: {claudeTokenizer.CountTokens("Hello world!")}");
Flow.AI.Core Provider Integration:
using Flow.AI.Core.Interfaces;
using TokenFlow.AI.Integration;

ITokenFlowProvider provider = new TokenFlowProvider("gpt-4o-mini");
int tokens = provider.CountTokens("gpt-4o-mini", "Hello Flow.AI!");
Console.WriteLine($"Token count: {tokens}");

๐Ÿ’ฐ CLI Usage (Positional Arguments)

Estimate Token Cost
tokenflow cost "Estimate my token cost" gpt-4o
Analyze Prompt Text
tokenflow analyze "Explain large language models simply." gpt-4o-mini
Compare Multiple Models
tokenflow compare "Summarize this text" gpt-4o gpt-3.5-turbo claude-3.5-sonnet
Count Tokens
tokenflow count "Estimate my token cost"
List Available Models
tokenflow list-models

๐Ÿ’ก All CLI commands support positional arguments โ€” text first, model second.
Named flags (--model, --input) will be added in a future developer-UX update.


๐Ÿงช Running Benchmarks

dotnet run -c Release --project src/TokenFlow.Tools.Benchmarks

Full benchmark documentation:
See


๐Ÿงช Running Tests

dotnet test --no-build --verbosity normal

All unit tests are written in xUnit and run automatically through GitHub Actions.
Code coverage is tracked with Codecov, and the project maintains 100% line and branch coverage across all modules.

๐Ÿ“Š Code Coverage by Module
Project Coverage Notes
TokenFlow.Core 100% Core models and interfaces
TokenFlow.AI 100% Client, costing, registry, Flow.AI integration
TokenFlow.Tokenizers 100% OpenAI, Claude, and Approx implementations
TokenFlow.Tools 100% CLI automation and output formatting

๐Ÿ”— Flow.AI.Core Integration

TokenFlow.AI fully implements the shared Flow.AI.Core.Interfaces.ITokenFlowProvider interface.
This enables all Flow.AI components โ€” including PromptStream.AI, DataFlow.AI, and ChatFlow.AI โ€”
to perform token counting and cost analysis through a unified provider contract.

TokenFlow.AI serves as the engine layer of the Flow.AI ecosystem, powering all higher-level orchestration frameworks.


๐Ÿ› ๏ธ Roadmap

โœ… Completed
  • Core interfaces and models (ITokenizer, ICostEstimator, ModelSpec, TokenCountResult)
  • Added TokenFlow.Tokenizers with advanced tokenizers (OpenAITikTokenizer, ClaudeTokenizer, ApproxTokenizer)
  • Extended TokenizerFactory to handle OpenAI/Claude families โœ…
  • Added TokenFlow.Tools.Benchmarks for tokenizer performance analysis โœ…
  • Achieved 100% code coverage across all projects โœ…
  • CLI v2.1 released with structured automation โœ…
  • Developer documentation site (API + usage guides) โœ…
  • Integrated Flow.AI.Core v0.1.0 and implemented ITokenFlowProvider โœ…
  • Full integration tests and shared registry loading โœ…
  • v0.6.1 โ€” Performance Regression Tracking integrated with CI โœ…
  • v0.6.2 โ€” Enhanced Cost Estimator using Flow.AI.Core registry โœ…
  • v0.7.0 โ€” CLI Alignment & Ecosystem Integration โœ…
๐ŸŒŸ Future Goals
  • Extend CLI tooling for full Flow.AI ecosystem interoperability
  • Implement enhanced Flow.AI shared configuration support
  • Add named argument flags (--model, --input) for CLI commands
  • Begin PromptStream.AI cockpit integration phase

๐Ÿ’ฌ Contributing

Pull requests are welcome!
If youโ€™d like to contribute to TokenFlow.AI, please read the upcoming CONTRIBUTING.md once published.


๐Ÿชช License

Distributed under the MIT License.
See for details.


โญ If you find TokenFlow.AI useful, please give the repository a star on GitHub!
It helps others discover the project and supports ongoing development.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on TokenFlow.AI:

Package Downloads
PromptStream.AI

Token-aware prompt composition, validation, and conversational context toolkit for .NET.

PromptStream.AI.Integration.TokenFlow

Integration adapter connecting PromptStream.AI with TokenFlow.AI for model-aware tokenization.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.1 302 10/13/2025
0.8.0 255 10/12/2025
0.7.8 421 10/9/2025
0.7.5 218 10/9/2025
0.7.4 223 10/9/2025
0.7.2 213 10/9/2025
0.7.1 225 10/9/2025
0.7.0 222 10/9/2025
0.4.0 218 10/7/2025
0.3.0 222 10/6/2025