RunPricingResolver
AgentPrism.Core.dllProvides the default IRunPricingResolver implementation. It
resolves prices from the model catalog, then AgentPrism:Pricing configuration.
public sealed class RunPricingResolver : IRunPricingResolverInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”When no provider is supplied, such as during historical recalculation, the
first provider that has the model name is used from either source. The
runs table has no provider column and IModelProviderRegistry.List
already orders providers alphabetically. Different prices for a same-named
model across providers are a known, accepted limitation; it
cannot be resolved without adding a provider column to runs.
Constructors
Section titled “Constructors”RunPricingResolver(IModelProviderRegistry, IOptions<AgentPrismOptions>, ILogger<RunPricingResolver>?)
Section titled “ RunPricingResolver(IModelProviderRegistry, IOptions<AgentPrismOptions>, ILogger<RunPricingResolver>?)”Initializes a price resolver.
public RunPricingResolver(IModelProviderRegistry registry, IOptions<AgentPrismOptions> options, ILogger<RunPricingResolver>? logger = null)Parameters
Section titled “Parameters”registry IModelProviderRegistry
The model catalog.
options IOptions<AgentPrismOptions>
The AgentPrism options and Pricing section.
logger ILogger<RunPricingResolver>?
The logger used to report a usage record that contradicts itself, such as more cached input tokens than input tokens in total. Optional: the price is still computed without it.
Exceptions
Section titled “Exceptions”A dependency is null.
Methods
Section titled “Methods”Resolve(string?, string?, RunUsage?)
Section titled “ Resolve(string?, string?, RunUsage?)”Resolves the cost.
public RunCost? Resolve(string? provider, string? model, RunUsage? usage)Parameters
Section titled “Parameters”provider string?
The provider name. If null (example: recomputing a historical row), the price is resolved by model name alone, using the first match across providers.
model string?
The model name. Cost does not apply if null or empty.
usage RunUsage?
The token usage. Cost does not apply if null.
Returns
Section titled “Returns”null only if model or
usage is missing (a case where cost can never apply
— for example, a code agent with no bound model). When the model is
known, a RunCost is always returned even if pricing is
undefined; in that case RunCost.Source is
PricingSource.Unknown and the cost fields are
null — not zero.