Counter
counter
Token counting with tiktoken.
CounterBackend
count(text, model='o200k_base')
Return the token count for text.
Uses tiktoken with model encoding. Falls back to len(text) // 4
when tiktoken is unavailable.
Source code in packages/axm-smelt/src/axm_smelt/core/counter.py
count_with_backend(text, model='o200k_base')
Return (token_count, backend) for text.
Falls back to len(text) // 4 when tiktoken is unavailable, and emits
a single warning the first time the fallback path is taken in a process.