Skip to main content
All documentation
API Reference 2 min readUpdated August 2026

Token counter telemetry

Understand token-count precision in each result.

Inspect the counter

token_counter_used reports the process-level active counter: tiktoken or heuristic.
tokens.py
from llmslim import compress
result = compress(long_text)
print(result.token_counter_used)
When is the heuristic used?

When the process cannot load the tiktoken encoder. LLMSlim emits one warning per process.