ContextUsed Property  
 

Returns the estimated number of context tokens currently used by the session history.

Syntax

object.ContextUsed

Remarks

The ContextUsed property is an Integer value that returns the estimated number of context tokens currently used by the active session history. This includes tokens associated with prompts, responses, system instructions and other retained conversation content managed by the control.

As additional messages are exchanged with the model, the amount of context used by the session will generally increase. When the accumulated context approaches the maximum context window supported by the model, older messages may need to be removed or truncated to remain within the model limits.

The value returned by this property is an estimate calculated by the control and may differ from the exact token usage reported by the service provider. Token usage can vary depending on the provider, model, tokenizer implementation and internal formatting used when constructing requests.

This property is primarily intended for informational or diagnostic purposes and should not be interpreted as an exact measurement of the provider's internal token usage.

Data Type

Integer (Int32)

See Also

ContextSize Property, HistorySize Property, InputTokens Property, MessageCount Property, OutputTokens Property, TotalTokens Property