# ToolCallUsage

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.toolcallusage/
> Summary: ToolCallUsage: A non-token measurement and its cost: one tool call's, or one item a workflow function node reported.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

A non-token measurement and its cost: one tool call's, or one item a
workflow function node reported.

```csharp
public sealed record ToolCallUsage : IEquatable<ToolCallUsage>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.toolcallusage/">ToolCallUsage</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;ToolCallUsage&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

The token cost model writes to the `runs` table. A tool or a function
node may spend no tokens but still incur a charge: text-to-speech is billed
by *character*, speech-to-text by *second*, a render by the
GPU second. The [ToolCallUsage.Quantity](/api/tracon.toolcallusage/#Tracon_ToolCallUsage_Quantity) is never added across units — two
different units cannot be added. The [ToolCallUsage.Cost](/api/tracon.toolcallusage/#Tracon_ToolCallUsage_Cost) is: the amounts of one
currency add up into the run's [RunNonTokenCost](/api/tracon.runnontokencost/), which is a total
of its own beside the token cost. An item with no [ToolCallUsage.Cost](/api/tracon.toolcallusage/#Tracon_ToolCallUsage_Cost), or one in
another currency, is listed and counted but not added.

A tool reports its measurement with `TraconToolUsage.Report(...)`; it
stays on the call's [ToolInvocationRecord](/api/tracon.toolinvocationrecord/). A workflow function node
reports with `IWorkflowContext.ReportUsageAsync(...)`; every report is
an item of its own.

## Constructors

### <a id="Tracon_ToolCallUsage__ctor"></a> ToolCallUsage\(\)

```csharp
public ToolCallUsage()
```

## Properties

### <a id="Tracon_ToolCallUsage_Cost"></a> Cost

The computed amount. Stays [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the
configuration has no price for this tool — **not** zero.

```csharp
public decimal? Cost { get; init; }
```

#### Property Value

 [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)?

### <a id="Tracon_ToolCallUsage_Currency"></a> Currency

The currency of `Cost`. Comes from `Tracon:Pricing:Currency`
for Tracon's own tools.

```csharp
public string? Currency { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

An empty label means `Tracon:Pricing:Currency`. An amount adds to the run's
total only when its currency is that one; any other currency is listed and
counted as not added (`RunNonTokenCost.UnsummedItemCount`).

### <a id="Tracon_ToolCallUsage_IsEstimated"></a> IsEstimated

Whether the quantity was measured or estimated.

```csharp
public bool IsEstimated { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

#### Remarks

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, so a reader of the record must
keep the two cases apart.

### <a id="Tracon_ToolCallUsage_Model"></a> Model

The model that did the work (for example `eleven_multilingual_v2`), or
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the reporter does not name one.

```csharp
public string? Model { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_ToolCallUsage_Provider"></a> Provider

The provider that did the work (for example `elevenlabs`), or
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the reporter does not name one.

```csharp
public string? Provider { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

A name for the reader of the record only. It takes no part in a total: the
same unit at two providers is still one unit.

### <a id="Tracon_ToolCallUsage_Quantity"></a> Quantity

The billed quantity.

```csharp
public required decimal Quantity { get; init; }
```

#### Property Value

 [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)

### <a id="Tracon_ToolCallUsage_Unit"></a> Unit

The measurement unit. See [ToolUsageUnits](/api/tracon.toolusageunits/) for known values.

```csharp
public required string Unit { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_ToolCallUsage_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolCallUsage_Equals_Tracon_ToolCallUsage_"></a> Equals\(ToolCallUsage?\)

```csharp
public bool Equals(ToolCallUsage? other)
```

#### Parameters

`other` [ToolCallUsage](/api/tracon.toolcallusage/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolCallUsage_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_ToolCallUsage_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_ToolCallUsage_op_Equality_Tracon_ToolCallUsage_Tracon_ToolCallUsage_"></a> operator ==\(ToolCallUsage?, ToolCallUsage?\)

```csharp
public static bool operator ==(ToolCallUsage? left, ToolCallUsage? right)
```

#### Parameters

`left` [ToolCallUsage](/api/tracon.toolcallusage/)?

`right` [ToolCallUsage](/api/tracon.toolcallusage/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_ToolCallUsage_op_Inequality_Tracon_ToolCallUsage_Tracon_ToolCallUsage_"></a> operator \!=\(ToolCallUsage?, ToolCallUsage?\)

```csharp
public static bool operator !=(ToolCallUsage? left, ToolCallUsage? right)
```

#### Parameters

`left` [ToolCallUsage](/api/tracon.toolcallusage/)?

`right` [ToolCallUsage](/api/tracon.toolcallusage/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
