pub fn count_tokens(text: &str) -> usize
Count tokens in text using the cl100k_base tokenizer.
text
cl100k_base
If the tokenizer fails to load (e.g. corrupted vocabulary file), falls back to the legacy heuristic: ceil(text.len() / 4).
ceil(text.len() / 4)