You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LLM model metadata catalog and cost calculator for .NET.
Provides context windows, pricing, capability flags (vision, audio, reasoning, tool calling, prompt caching), and thinking/reasoning format metadata for 12+ providers including OpenAI, Anthropic, Google, xAI, Mistral, DeepSeek, and more.
Packages
Package
Description
TokenMeter
Full model catalog + cost calculation
Installation
dotnet add package TokenMeter
Quick Start
Model Lookup
// Find a model by ID or aliasvarmodel=ModelCatalog.FindModel("claude-sonnet-4-6");Console.WriteLine(model?.ContextWindow);// 1000000Console.WriteLine(model?.ReasoningMode);// OptionalConsole.WriteLine(model?.ThinkingFormat);// BlockConsole.WriteLine(model?.PromptCachingMode);// ExplicitConsole.WriteLine(model?.ToolCallingFormat);// AnthropicConsole.WriteLine(model?.SupportsMcpToolUse);// True
Note — fuzzy matching: FindModel resolves aliases in 4 passes (exact → alias exact →
prefix → contains) to absorb cloud-specific ID variants (Bedrock/Vertex prefixes, date
suffixes). Local/self-hosted deployment names that embed a public model name (e.g.
deepseek-r1-distill-qwen-7b) can therefore match a catalog entry whose context window and
pricing do not describe your deployment. For self-hosted models, take the effective context
length from your deployment configuration (e.g. llama.cpp n_ctx), not from the catalog.
// When correctness matters more than recall, bound the fuzziness:ModelCatalog.FindModel("deepseek-r1-distill-qwen-7b",AliasMatchType.Exact);// null — no false positiveModelCatalog.FindModel("us.anthropic.claude-sonnet-4.6-v1");// matched via contains alias// Or inspect which pass produced the match and apply confidence-based fallback:varmatch=ModelCatalog.FindModelMatch("deepseek-r1-distill-qwen-7b");Console.WriteLine(match?.MatchKind);// Prefix — a fuzzy inference, not an exact hitConsole.WriteLine(match?.Model.ModelId);
Cost Calculation
// Basic cost (input + output tokens)varcost=model?.CalculateCost(inputTokens:500_000,outputTokens:200_000);// Cost including prompt cache tokensvarcostWithCache=model?.CalculateCost(inputTokens:100_000,outputTokens:50_000,cacheReadTokens:400_000,cacheWriteTokens:50_000);// Via CostCalculator (DI-friendly)ICostCalculatorcalc=CostCalculator.Default();varprice=calc.CalculateCost("gpt-4o",inputTokens:1_000,outputTokens:500);
Browsing the Catalog
// By provider — typed convenience propertyforeach(varminModelCatalog.Anthropic.Values)Console.WriteLine($"{m.ModelId}: ctx={m.ContextWindow}, ${m.InputPricePerMillion}/M");// By provider — string-keyed (when the name is only known at runtime)varopenai=ModelCatalog.GetProvider("OpenAI");// dict, empty if unknown// By model type (the built-in catalog currently contains Chat models only)varchatModels=ModelCatalog.GetByType(ModelType.Chat);// All providersvarproviders=ModelCatalog.GetProviderNames();
Tag pattern (e.g., <think>...</think>) for InlineTag format
ThinkingFieldName
Field name (e.g., reasoning_content) for SeparateField format
SupportsInterleavedThinking
Reasoning between tool calls
MaxThinkingTokens
Maximum reasoning budget
Tool Calling Wire Format
Value
Description
ToolCallingFormat.OpenAI
tool_calls / tool role (default)
ToolCallingFormat.Anthropic
tool_use / tool_result content blocks
ToolCallingFormat.Gemini
Google Gemini format
Supported Providers
Provider
Models
OpenAI
GPT-5.x, GPT-4.1, GPT-4o, o1, o3, o4-mini series
Anthropic
Claude 5, 4.x, 3.x families (Fable, Opus, Sonnet, Haiku)
Google
Gemini 3.x, 2.5, 2.0, 1.5 families
xAI
Grok 4.x, 3.x series
Azure
Azure OpenAI equivalents
Mistral
Large, Medium, Small, Magistral, Pixtral
DeepSeek
R1 (reasoning), V3, Coder
Amazon Nova
Premier, Pro, Lite, Micro
Cohere
Command A, R+, R, R7B
Meta Llama
Maverick, Scout
Perplexity
Sonar Pro, Deep Research, Reasoning
Qwen
Max, Plus, Turbo
Data Freshness
Console.WriteLine(ModelCatalog.LastUpdated);// 2026-07-06Console.WriteLine(ModelCatalog.DataAgeDays);// days since last updateConsole.WriteLine(ModelCatalog.IsDataStale());// true if > 90 days old
.NET library for accurate token counting, cost calculation, and session-based usage tracking across 12 LLM providers including OpenAI, Anthropic, Google, Azure, and more.