Table of Contents

Class Usage

Represents the token usage of an inference request.

public record Usage
Inheritance
object
Usage

Constructors

Usage(string, int, int)

public Usage(string modelProvider, int inputTokens, int outputTokens)

Parameters

modelProvider string

The model provider that the usage is associated with.

inputTokens int

The number of input tokens used in the inference request.

outputTokens int

The number of output tokens the inference request generated.

Fields

Empty

Empty value.

public static readonly Usage Empty

Field Value

Usage

InputTokens

The number of input tokens used in the inference request.

public readonly int InputTokens

Field Value

int

ModelProvider

The model provider that the usage is associated with.

public readonly string ModelProvider

Field Value

string

OutputTokens

The number of output tokens the inference request generated.

public readonly int OutputTokens

Field Value

int

Methods

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator +(Usage, Usage)

Adds two usage objects together.

public static Usage operator +(Usage a, Usage b)

Parameters

a Usage
b Usage

Returns

Usage

Exceptions

InvalidOperationException

Thrown if the model providers of the objects are different and neither are Empty.