# RunUsage

> 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.runusage/
> Summary: RunUsage: Token usage of a run.

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

Token usage of a run.

```csharp
public sealed record RunUsage : IEquatable<RunUsage>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.runusage/">RunUsage</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;RunUsage&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 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](/api/tracon.runusage/#Tracon_RunUsage_CachedInputTokens) to `InputTokens` therefore
counts the same tokens twice.

A field a provider does not report stays [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/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".

## Constructors

### <a id="Tracon_RunUsage__ctor"></a> RunUsage\(\)

```csharp
public RunUsage()
```

## Properties

### <a id="Tracon_RunUsage_AudioInputTokens"></a> AudioInputTokens

Gets the audio input tokens. Counted INSIDE `InputTokens`.

```csharp
public long? AudioInputTokens { get; init; }
```

#### Property Value

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

Recorded for reporting; it carries no separate rate yet.

### <a id="Tracon_RunUsage_AudioOutputTokens"></a> AudioOutputTokens

Gets the audio output tokens. Counted INSIDE `OutputTokens`.

```csharp
public long? AudioOutputTokens { get; init; }
```

#### Property Value

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

Recorded for reporting; it carries no separate rate yet.

### <a id="Tracon_RunUsage_CachedInputTokens"></a> CachedInputTokens

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

```csharp
public long? CachedInputTokens { get; init; }
```

#### Property Value

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

[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the provider does not report it. While it is
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) the whole input is priced at the full input rate,
which is what Tracon did before this field existed.

### <a id="Tracon_RunUsage_InputTokens"></a> InputTokens

Gets the number of input tokens.

```csharp
public long? InputTokens { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)?

### <a id="Tracon_RunUsage_OutputTokens"></a> OutputTokens

Gets the number of output tokens.

```csharp
public long? OutputTokens { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)?

### <a id="Tracon_RunUsage_ReasoningTokens"></a> ReasoningTokens

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

```csharp
public long? ReasoningTokens { get; init; }
```

#### Property Value

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

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.

### <a id="Tracon_RunUsage_TotalTokens"></a> TotalTokens

Gets the total number of tokens.

```csharp
public long? TotalTokens { get; init; }
```

#### Property Value

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

### <a id="Tracon_RunUsage_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_RunUsage_Equals_Tracon_RunUsage_"></a> Equals\(RunUsage?\)

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

`other` [RunUsage](/api/tracon.runusage/)?

#### Returns

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

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

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

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

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

### <a id="Tracon_RunUsage_op_Equality_Tracon_RunUsage_Tracon_RunUsage_"></a> operator ==\(RunUsage?, RunUsage?\)

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

`left` [RunUsage](/api/tracon.runusage/)?

`right` [RunUsage](/api/tracon.runusage/)?

#### Returns

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

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

`left` [RunUsage](/api/tracon.runusage/)?

`right` [RunUsage](/api/tracon.runusage/)?

#### Returns

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