Skip to main content

CHARS_PER_TOKEN

Constant CHARS_PER_TOKEN 

Source
pub const CHARS_PER_TOKEN: usize = 4;
Expand description

Approximate bytes per token used by the byte-length heuristic.

Single source of truth for the ~4 chars/token convention shared by preview budgets, schema estimates, and message metadata. BPE-backed estimate_tokens stays the default; the heuristic exists for hot paths and serialized payloads where running the tokenizer costs more than the accuracy is worth.