TokensBill.AspNetCore 0.4.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package TokensBill.AspNetCore --version 0.4.9
                    
NuGet\Install-Package TokensBill.AspNetCore -Version 0.4.9
                    
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="TokensBill.AspNetCore" Version="0.4.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TokensBill.AspNetCore" Version="0.4.9" />
                    
Directory.Packages.props
<PackageReference Include="TokensBill.AspNetCore" />
                    
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 TokensBill.AspNetCore --version 0.4.9
                    
#r "nuget: TokensBill.AspNetCore, 0.4.9"
                    
#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 TokensBill.AspNetCore@0.4.9
                    
#: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=TokensBill.AspNetCore&version=0.4.9
                    
Install as a Cake Addin
#tool nuget:?package=TokensBill.AspNetCore&version=0.4.9
                    
Install as a Cake Tool

TokensBill.AspNetCore

One line. Every AI token tracked. Automatically captures Anthropic / OpenAI / Gemini token usage from your app's outgoing AI calls and streams it to your TokensBill dashboard — so you can see exactly where your AI spend goes.

Install

dotnet add package TokensBill.AspNetCore

Use — one line at startup

builder.Services.AddTokensBill("tl_live_your_project_key");

Add it in Program.cs where you register services. That's it — every AI API call your app makes through HttpClient is now tracked automatically.

Get your project key from TokensBill → your project → Integration.

What it does

  • Hooks the HttpClient factory pipeline via an IHttpMessageHandlerBuilderFilter.
  • Reads token counts and cost from the AI provider's response without altering your call.
  • Sends the numbers to TokensBill from a background worker.
  • Silent-fail by design — it never throws into, blocks, or slows your application. If TokensBill is unreachable, your app is completely unaffected.

Is the key safe to commit?

The tracking key is a label, not a password. It cannot access your AI provider account, read your prompts, or spend money — it only lets your app report usage numbers to your dashboard. You can regenerate it any time from the dashboard.

Options

builder.Services.AddTokensBill("tl_live_...", cfg =>
{
    cfg.Environment = "production";   // production | staging | development
    cfg.IngestBaseUrl = "https://tokensbill.aiappsjunction.com"; // override the endpoint
});

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 160 9/1/2026
1.0.1 128 8/20/2026
1.0.0 123 8/17/2026
0.8.1 124 8/12/2026
0.8.0 115 8/12/2026
0.6.0 114 8/9/2026
0.5.0 124 8/7/2026
0.4.9 124 7/30/2026
0.4.8 123 7/26/2026
0.4.7 120 7/23/2026
0.4.6 127 7/23/2026
0.4.5 124 7/22/2026
0.4.4 131 7/22/2026
0.4.3 121 7/20/2026
0.4.2 120 7/16/2026
0.4.1 121 7/12/2026
0.3.1 133 7/9/2026
0.2.1 134 7/2/2026
0.2.0 127 7/2/2026
0.1.0 124 7/1/2026

0.4.8 — TokensBill.AspNetCore is now the single SDK for tracking, utility functions (EstimateCost, EstimateTokens, CompareCosts, Deduplicate, RetryWithBudget) and AI functions (Summarize, ExtractJson, Classify, Chat, Embed). TokensBill.AI deprecated in favour of this package.