package
Version:
v0.1.5
Opens a new window with list of versions in this module.
Published: Mar 3, 2026
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Count returns the number of tokens in the given text for the specified model.
Falls back to cl100k_base encoding if the model is not recognized.
CountMessages estimates token usage for a chat completion messages array.
Uses the OpenAI token counting heuristic: each message adds overhead tokens.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.