Serving and cost
tokenmeter
Count tokens and estimate prompt cost before sending.
Install
pip install tokenmeter-cliOnce published to PyPI. Also available now from GitHub:
pip install git+https://github.com/jmweb-org/tokenmeterWhat it does
Prompt templates grow, an example gets added, the retrieved context balloons, and suddenly every call costs more than you thought. tokenmeter gives the exact count and a dollar estimate up front.
Features
- —Exact counting with tiktoken for OpenAI encodings.
- —Per-model cost estimate from a dated table.
- —A file, a directory or stdin.
- —Budget gate for CI.