<story><title>Show HN: Token price calculator for 400+ LLMs</title><url>https://github.com/AgentOps-AI/tokencost</url><text>Hey HN! Tokencost is a utility library for estimating LLM costs. There are hundreds of different models now, and they all have their own pricing schemes. It’s difficult to keep up with the pricing changes, and it’s even more difficult to estimate how much your prompts and completions will cost until you see the bill.&lt;p&gt;Tokencost works by counting the number of tokens in prompt and completion messages and multiplying that number by the corresponding model cost. Under the hood, it’s really just a simple cost dictionary and some utility functions for getting the prices right. It also accounts for different tokenizers and float precision errors.&lt;p&gt;Surprisingly, most model providers don&amp;#x27;t actually report how much you spend until your bills arrive. We built Tokencost internally at AgentOps to help users track agent spend, and we decided to open source it to help developers avoid nasty bills.</text></story><parent_chain></parent_chain><comment><author>yelnatz</author><text>Can you do a column and normalize them?&lt;p&gt;Too many zeroes for my blind ass making it hard to compare.</text></comment>
<story><title>Show HN: Token price calculator for 400+ LLMs</title><url>https://github.com/AgentOps-AI/tokencost</url><text>Hey HN! Tokencost is a utility library for estimating LLM costs. There are hundreds of different models now, and they all have their own pricing schemes. It’s difficult to keep up with the pricing changes, and it’s even more difficult to estimate how much your prompts and completions will cost until you see the bill.&lt;p&gt;Tokencost works by counting the number of tokens in prompt and completion messages and multiplying that number by the corresponding model cost. Under the hood, it’s really just a simple cost dictionary and some utility functions for getting the prices right. It also accounts for different tokenizers and float precision errors.&lt;p&gt;Surprisingly, most model providers don&amp;#x27;t actually report how much you spend until your bills arrive. We built Tokencost internally at AgentOps to help users track agent spend, and we decided to open source it to help developers avoid nasty bills.</text></story><parent_chain></parent_chain><comment><author>simonw</author><text>I don&amp;#x27;t understand how the Claude functionality works.&lt;p&gt;As far as I know Anthropic haven&amp;#x27;t released the tokenizer for Claude - unlike OpenAI&amp;#x27;s tiktoken - but your tool lists the Claude 3 models as supported. How are you counting tokens for those?</text></comment>