# TurnUsage

Represents token usage details for a single turn.

Class 

`IntelligenceX.OpenAI.AppServer.Models`

**Namespace**

`IntelligenceX.OpenAI.AppServer.Models`

**Assembly**

`IntelligenceX`

**Source**

[TurnInfo.cs:98](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L98)

**Modifiers**

sealed

Represents token usage details for a single turn.

## Inheritance

- object
- TurnUsage

## Usage

Explore 3 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 2

- Property [TurnInfo.Usage](/api/intelligencex-openai-appserver-models-turninfo/#property-usage)
- Method [TurnUsage.FromJson](/api/intelligencex-openai-appserver-models-turnusage/#method-fromjson-intelligencex-json-jsonobject)

### Accepted by parameters 1

- Constructor [TurnInfo.TurnInfo](/api/intelligencex-openai-appserver-models-turninfo/#constructor-ctor-string-string-string-collections-generic-ireadonlylist-intelligencex-openai-appserver-models-turnoutput-collections-generic-ireadonlylist-intelligencex-openai-appserver-models-turnoutput-intelligencex-json-jsonobject-intelligencex-json-jsonobject-intelligencex-openai-appserver-models-turnusage) parameter `usage`

Filter members 

Show inherited

## Constructors

`public TurnUsage(long? inputTokens, long? outputTokens, long? totalTokens, long? cachedInputTokens, long? reasoningTokens, JsonObject raw, JsonObject? additional)` [#](#constructor-ctor-nullable-system-int64-nullable-system-int64-nullable-system-int64-nullable-system-int64-nullable-system-int64-intelligencex-json-jsonobject-intelligencex-json-jsonobject)

[TurnInfo.cs:98](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L98)

Initializes a new turn usage model.

Parameters

**inputTokens long? required**

**outputTokens long? required**

**totalTokens long? required**

**cachedInputTokens long? required**

**reasoningTokens long? required**

**raw IntelligenceX.Json.JsonObject required**

**additional IntelligenceX.Json.JsonObject? required**

## Methods

`public static TurnUsage? FromJson(JsonObject? obj)` [#](#method-fromjson-intelligencex-json-jsonobject)

[TurnInfo.cs:144](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L144)

Parses turn usage from JSON.

Parameters

**obj IntelligenceX.Json.JsonObject? required**

Source usage object.

Returns

`TurnUsage?` The parsed usage or null.

`public JsonObject ToJson()` [#](#method-tojson)

[TurnInfo.cs:173](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L173)

Serializes usage to JSON.

Returns

`JsonObject`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public long? InputTokens { get; }` [#](#property-inputtokens)

[TurnInfo.cs:112](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L112)

Gets input/prompt token count.

`public long? OutputTokens { get; }` [#](#property-outputtokens)

[TurnInfo.cs:116](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L116)

Gets output/completion token count.

`public long? TotalTokens { get; }` [#](#property-totaltokens)

[TurnInfo.cs:120](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L120)

Gets total token count.

`public long? CachedInputTokens { get; }` [#](#property-cachedinputtokens)

[TurnInfo.cs:124](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L124)

Gets cached input token count.

`public long? ReasoningTokens { get; }` [#](#property-reasoningtokens)

[TurnInfo.cs:128](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L128)

Gets reasoning token count.

`public JsonObject Raw { get; }` [#](#property-raw)

[TurnInfo.cs:132](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L132)

Gets the raw JSON usage object.

`public JsonObject? Additional { get; }` [#](#property-additional)

[TurnInfo.cs:136](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Providers/OpenAI/AppServer/Models/TurnInfo.cs#L136)

Gets unrecognized fields from the payload.

<!-- PowerForge markdown artifact sha256:39BA369C2FC8A7E9A398A267C803D1DDC145DE7006775F0C47B2921345A79E34 -->
