This structure is used to return token usage information
for an active client session. It provides a summary of how many messages
are currently in the session history, how many tokens have been used for
input and output, and how much of the available context window is
currently in use.
The nInputTokens member reflects tokens associated
with user and system input, while nOutputTokens reflects tokens
generated by the model in its responses. The nContextUsed member
represents the total token usage currently contributing to the active
chat context, including prior message history that may be sent with each
request.
The nContextSize member indicates the maximum
context size supported by the current model, when that information is
available. Applications may compare nContextUsed with
nContextSize to estimate how much of the available context
window has been consumed.
This structure is intended for informational and diagnostic
use. Token counts are provider-dependent and may represent estimates
rather than exact values, depending on the model or service in use.
Applications should not rely on these values to enforce strict limits,
as the provider ultimately determines whether a request exceeds its
supported context or token constraints.
Applications should set the dwSize member before
passing this structure to a function. Unless otherwise documented,
reserved members should be set to zero. String values are stored
directly in the fixed-length buffers contained within the structure and
may be read safely by the application.