.NET API
RunCost
Tracon.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.
CachedInputPricePerMillionTokens
Section titled “ CachedInputPricePerMillionTokens”Gets the cache-read price, per million tokens, that produced
CachedInputCost. null when no cache rate
was applied — either the cache rate is undefined, or the provider
reported no cache read at all.
public decimal? CachedInputPricePerMillionTokens { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Not a cost addend — see RunCost.InputPricePerMillionTokens.
Currency
Section titled “ Currency”Gets the currency, taken from Tracon:Pricing:Currency.
public string? Currency { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Required whenever RunCost.Source is not PricingSource.Unknown: a known price with no currency label is a resolver defect, not a legitimate state.
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”InputPricePerMillionTokens
Section titled “ InputPricePerMillionTokens”Gets the input price, per million tokens, that produced
InputCost. null when the price is unknown.
public decimal? InputPricePerMillionTokens { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”This is not a fourth addend of RunCost.Total: it is the rate, not an amount. Adding it to the cost total would double-count the same charge on a different scale — RunCost.Total sums only RunCost.InputCost, RunCost.OutputCost and RunCost.CachedInputCost.
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”OutputPricePerMillionTokens
Section titled “ OutputPricePerMillionTokens”Gets the output price, per million tokens, that produced
OutputCost. null when the price is unknown.
public decimal? OutputPricePerMillionTokens { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Not a cost addend — see RunCost.InputPricePerMillionTokens.
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.
RunCost.InputPricePerMillionTokens, RunCost.OutputPricePerMillionTokens
and RunCost.CachedInputPricePerMillionTokens are rates, not amounts —
they must never be added here.
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?