RunCost
AgentPrism.Abstractions.dllCost of a run. It is computed and written once when the run ends (a price snapshot) — a later change to the price list does not change past values.
public sealed record RunCost : IEquatable<RunCost>Inheritance
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()
Constructors
Section titled “Constructors”RunCost()
Section titled “ RunCost()”public RunCost()Properties
Section titled “Properties”CachedInputCost
Section titled “ CachedInputCost”Gets the cost of the input tokens that were served from the prompt cache, or null when no cache read was priced.
public decimal? CachedInputCost { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The cached tokens are subtracted from RunCost.InputCost and charged here instead, so the two fields still add up to the run’s input spend and must not be double counted.
An undefined cache rate does not push the run to PricingSource.Unknown: the cached tokens are then priced at the normal input rate and the total stays exactly what it was before this field existed. PricingSource.Unknown means the MODEL price is missing, which is a different fault.
Currency
Section titled “ Currency”Gets the currency, taken from AgentPrism:Pricing:Currency.
public string? Currency { get; init; }Property Value
Section titled “Property Value”InputCost
Section titled “ InputCost”Gets the input token cost, or null when the price is unknown.
public decimal? InputCost { get; init; }Property Value
Section titled “Property Value”OutputCost
Section titled “ OutputCost”Gets the output token cost, or null when the price is unknown.
public decimal? OutputCost { get; init; }Property Value
Section titled “Property Value”Source
Section titled “ Source”Gets where the price came from.
public required PricingSource Source { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(RunCost?)
Section titled “ Equals(RunCost?)”public bool Equals(RunCost? other)Parameters
Section titled “Parameters”other RunCost?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Total()
Section titled “ Total()”Gets the run’s total cost — input, output and cache read together.
public decimal? Total()Returns
Section titled “Returns”null when the run was never priced at all. Zero would say “it cost nothing”, which is a different claim.
Remarks
Section titled “Remarks”Every caller that needs “what did this run cost” must use THIS, never
InputCost + OutputCost. RunCost.CachedInputCost is a third
addend, not a subset of RunCost.InputCost: the resolver subtracts
the cached tokens out of the input charge and bills them here. A hand
written two-term sum under-reports every run that hit the prompt cache —
and a quota ceiling computed that way can be exceeded.
Operators
Section titled “Operators”operator ==(RunCost?, RunCost?)
Section titled “ operator ==(RunCost?, RunCost?)”public static bool operator ==(RunCost? left, RunCost? right)Parameters
Section titled “Parameters”left RunCost?
right RunCost?
Returns
Section titled “Returns”operator !=(RunCost?, RunCost?)
Section titled “ operator !=(RunCost?, RunCost?)”public static bool operator !=(RunCost? left, RunCost? right)Parameters
Section titled “Parameters”left RunCost?
right RunCost?