Skip to content

RunUsage

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Token usage of a run.

public sealed record RunUsage : IEquatable<RunUsage>

objectRunUsage

IEquatable<RunUsage>

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The breakdown fields are counted inside the three totals, never beside them — the contract is inherited verbatim from Microsoft.Extensions.AI.UsageDetails, whose documentation states that cached input tokens are part of the input token count. Adding RunUsage.CachedInputTokens to InputTokens therefore counts the same tokens twice.

A field a provider does not report stays null; it is never written as zero. Zero is the claim “this was measured and it was none”, which is a different statement from “this was not measured”.

public RunUsage()

Gets the audio input tokens. Counted INSIDE InputTokens.

public long? AudioInputTokens { get; init; }

long?

Recorded for reporting; it carries no separate rate yet.

Gets the audio output tokens. Counted INSIDE OutputTokens.

public long? AudioOutputTokens { get; init; }

long?

Recorded for reporting; it carries no separate rate yet.

Gets the input tokens that were served from the provider’s prompt cache. Counted INSIDE InputTokens.

public long? CachedInputTokens { get; init; }

long?

null when the provider does not report it. While it is null the whole input is priced at the full input rate, which is what AgentPrism did before this field existed.

Gets the number of input tokens.

public long? InputTokens { get; init; }

long?

Gets the number of output tokens.

public long? OutputTokens { get; init; }

long?

Gets the tokens the model spent on reasoning. Counted INSIDE OutputTokens.

public long? ReasoningTokens { get; init; }

long?

Recorded for reporting. It is priced at the output rate, because providers do not currently bill it separately; a separate rate would be an unmeasured distinction baked into the price schema.

Gets the total number of tokens.

public long? TotalTokens { get; init; }

long?

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(RunUsage? other)

other RunUsage?

bool

public override int GetHashCode()

int

public override string ToString()

string

public static bool operator ==(RunUsage? left, RunUsage? right)

left RunUsage?

right RunUsage?

bool

public static bool operator !=(RunUsage? left, RunUsage? right)

left RunUsage?

right RunUsage?

bool