klyn.llm.LLMChatSession.contextTokens
property
public readonly property contextTokens as Int
Description

Current cached context occupancy, read in O(1) on the session owner thread. Appended messages, restored history and compaction use estimates until the next provider response supplies usage. Use contextUsage to publish an immutable snapshot to another thread. Provider usage includes the input summarized by a compactor and must not be mistaken for the size of its replacement context.

Returns

Last known active-context size in tokens.

Example

print(session.contextTokens)