Skip to content

ToolCallUsage

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

A single tool call’s non-token measurement and cost.

public sealed record ToolCallUsage : IEquatable<ToolCallUsage>

objectToolCallUsage

IEquatable<ToolCallUsage>

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

The cost model assumes tokens and writes to the runs table. A tool may spend no tokens but still incur a charge: text-to-speech is billed by character, speech-to-text by second. These measurements are not summed with token cost — two different units cannot be added. They are shown as a separate line item in reports.

The measurement is reported by the tool itself: AgentPrismToolUsage.Report(...).

public ToolCallUsage()

The computed amount. Stays null if the configuration has no price for this tool — not zero.

public decimal? Cost { get; init; }

decimal?

The currency. Comes from AgentPrism:Pricing:Currency.

public string? Currency { get; init; }

string?

Whether the quantity was measured or estimated.

public bool IsEstimated { get; init; }

bool

If the provider does not report the billed quantity, the tool produces an estimate (for example, the text’s character count). Showing an estimate as a measurement fabricates a price; the UI distinguishes the two cases.

The billed quantity.

public required decimal Quantity { get; init; }

decimal

The measurement unit. See ToolUsageUnits for known values.

public required string Unit { get; init; }

string

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(ToolCallUsage? other)

other ToolCallUsage?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(ToolCallUsage?, ToolCallUsage?)

Section titled “ operator ==(ToolCallUsage?, ToolCallUsage?)”
public static bool operator ==(ToolCallUsage? left, ToolCallUsage? right)

left ToolCallUsage?

right ToolCallUsage?

bool

operator !=(ToolCallUsage?, ToolCallUsage?)

Section titled “ operator !=(ToolCallUsage?, ToolCallUsage?)”
public static bool operator !=(ToolCallUsage? left, ToolCallUsage? right)

left ToolCallUsage?

right ToolCallUsage?

bool