chatoyant.tokens
Chatoyant_tokens.Token_estimate
Heuristic token estimation.
These functions intentionally mirror the current TypeScript package's zero-dependency token estimates. They are fast approximations, not provider tokenizer bindings.
chatoyant
chatoyant.core
chatoyant.native
chatoyant.provider
chatoyant.runtime
chatoyant.schema
chatoyant_ppx
type content_kind =
| English
| Code
| Cjk
| Mixed
type prompt_estimate = {
input : int;
output : int;
total : int;
}
val chars_per_token : content_kind -> float
val classify : string -> content_kind
val estimate : string -> int
val estimate_prompt : ?response:string -> string -> prompt_estimate
val estimate_many : string list -> int
val estimate_with_ratio : chars_per_token:float -> string -> int