CLlmClient::GetTokenUsage Method  
 
BOOL GetTokenUsage(
  LPLLM_TOKEN_USAGE lpUsage  
);

The GetTokenUsage method returns token usage statistics for the client session.

Parameters

lpUsage
A pointer to an LLM_TOKEN_USAGE structure which receives token usage statistics for the client session. The dwSize member must be initialized to the size of the structure before calling this method.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetTokenUsage method returns token usage statistics for the specified client session. This information includes token counts reported by the provider, as well as values maintained by the library for the current conversation history.

The lpUsage parameter must point to an LLM_TOKEN_USAGE structure initialized by the caller. The dwSize member must be set to the size of the structure. This enables the method to validate the structure version before returning usage information.

Token usage values are intended to help applications monitor request size, response size and context usage. The exact values reported may vary by provider and model, and should be treated as informational rather than as a guarantee of billing or model behavior.

This method returns the usage information currently associated with the client session. The values are updated as messages are sent and responses are received.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also