TokenEconomy 0.2.0

dotnet add package TokenEconomy --version 0.2.0
                    
NuGet\Install-Package TokenEconomy -Version 0.2.0
                    
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="TokenEconomy" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TokenEconomy" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="TokenEconomy" />
                    
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 TokenEconomy --version 0.2.0
                    
#r "nuget: TokenEconomy, 0.2.0"
                    
#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 TokenEconomy@0.2.0
                    
#: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=TokenEconomy&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=TokenEconomy&version=0.2.0
                    
Install as a Cake Tool

Token Economy

Token economics for LLM coding agents — one tested source for model pricing (with history), run-cost computation, and token-efficiency model selection. .NET, dependency-free core.

Part of the coding-agent family (coding-agent-runner, coding-agent-chat).

Docs & website: https://agent-orchestrator.dev/token-economy/ — a static site built from website/ and deployed by deploy-website.yml (see website/DEPLOY.md).

Research plan: Forecast each task as a percentage of a five-hour cap defines the proposed measurement, uncertainty, repository boundaries, and GO-blocked delivery slices. Its visual explainers are part of the static site. No forecast implementation is authorised yet.

What it does

  • Pricing catalog with history — per-model price entries keyed by ValidFrom; a run's cost is computed with the prices valid at the run's timestamp. Historic entries are kept, never overwritten.
  • Cost APIComputeCost(model, usage, atUtc) → deterministic breakdown + total; unknown models return an explicit unknown, never a silent zero.
  • Token-efficiency matrixSuggestModel(taskClass, budgetPressure, availableClis, atUtc): which model buys the most for these tokens, ranked with a rationale string for audit trails. Cost class is derived from the pricing catalog, never restated.

Install

dotnet add package TokenEconomy

Dependency-free, targets net10.0.

Usage

using TokenEconomy;

// The seeded catalog: known Claude 4.x/5 and OpenAI gpt-5.x models.
var breakdown = ModelPriceCatalog.Default.ComputeCost(
    "claude-opus-4-8",
    new TokenUsage(Input: 250_000, Output: 12_000, CacheRead: 40_000),
    DateTime.UtcNow);

if (breakdown.HasPrice)
    Console.WriteLine($"{breakdown.Total} {breakdown.Currency}");   // ≈ 1.57 USD
else
    Console.WriteLine(breakdown.Status);   // UnknownModel or NoPriceForDate — never a silent $0

Total is null for an unknown or unpriced model, never 0 — a missing price is always explicit. Prices carry history, so a run at an earlier timestamp is costed with the rate that was valid then.

Picking a model for a task under budget pressure

using TokenEconomy;

// Which model should run a plain feature when the budget is getting tight and
// only the Claude CLI has quota right now?
var ranked = ModelEfficiencyMatrix.Default.SuggestModel(
    TaskClass.Feature,
    BudgetPressure.Tight,
    availableClis: [Cli.Claude],
    atUtc: DateTime.UtcNow);

var best = ranked[0];   // empty list ⇒ nothing available; wait, don't launch
Console.WriteLine($"{best.ModelId} @ {best.SuggestedEffort} — {best.Rationale}");
// e.g. claude-sonnet-5 @ medium — claude-sonnet-5: balanced tier, an ideal
// match for feature work; standard cost — moderate spend under tight pressure.
// Suggested effort: medium.

Capability fit leads the ranking; budget pressure tips the balance toward cheaper models (a downshift). Cost class is derived from the pricing catalog, so it never restates a price and tracks price history over time. The matrix is data + pure functions — the policy of when to downshift / throttle / wait stays in the caller's admission algorithm.

Status

The pricing catalog + cost API were extracted from CodingAgentRunner.Pricing (v0.5.0) into this standalone package (0.1.0); 0.2.0 adds the token-efficiency matrix + SuggestModel. Tag-ready; the first nuget.org publish is pending — see docs/PUBLISHING.md. Package id: TokenEconomy (nuget.org).

License

Apache-2.0 — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.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
0.2.0 679 7/21/2026