Live data from Hacker News

Show HN: Token price calculator for 400+ LLMs

github.com

51–60 of 79 posts

Re: Show HN: Token price calculator for 400+ LLMs

#53

[flagged]

I grappled with that issue for https://github.com/pamelafox/openai-messages-token-helper as I wanted to be able to use it for a quick token check with SLMs as well, so I ended up adding a parameter "fallback_to_default" for developers to indicate they're okay with assuming gpt-35 BPE encoding.

Re: Show HN: Token price calculator for 400+ LLMs

#54
post #2

I don't understand how the Claude functionality works. As far as I know Anthropic haven't released the tokenizer for Claude - unlike OpenAI's tiktoken - but your tool lists the Claude 3 models as supported. How are you counting tokens for those?

Here you go https://github.com/javirandor/anthropic-tokenizer

Re: Show HN: Token price calculator for 400+ LLMs

#56
Would anybody be interested in this for Rust? I already do everything this library does with the exception of returning the price in my LLM utils crate [1]. I do this just to count tokens to ensure prompts stay within limits. And I also support non-open ai tokenizers. So adding a price calculator function would be trivial.

[1] https://github.com/ShelbyJenkins/llm_utils

Re: Show HN: Token price calculator for 400+ LLMs

#57
post #49

An interesting parameter that I don't read about a lot is vocab size. A larger vocab means you will need to generate less tokens for the same word on average, also the context window will be larger. This means that a model with a large vocab might be more expensive on a per token basis, but would generate less tokens for the same sentence, making it cheaper overall. This should be taken into consideration when compar…

Yeah... it obviously uses the appropriate tokenizer

Re: Show HN: Token price calculator for 400+ LLMs

#58

Earlier quoted context omitted.

This is unnecessarily harsh. Not every model has a publicly available tokenizer, and using a fallback like cl100k is usually a decent enough estimator from my experience. Besides, there's a warning message for when you specify a model without a known tokenizer. If you're upset with the implementation, you can always raise an issue or fix it yourself

> This is unnecessarily harsh. Which part? All I can tease out from your comment are "the lies are impossible" (agreed!) and "close enough afaik". (it's not, the closest in the Big 5 has percent error of 32% , see end of comment. ex. GPT4o has a tokenizer with 2x the vocab so you'd expect ~1/2 the tokens) > Not every model has a publicly available tokenizer, Right. Ex. Claude 3s and Geminis. So why are Claude 3s and…

I can tell you've never actually built anything worthwhile

Re: Show HN: Token price calculator for 400+ LLMs

#59

[flagged]

I’m not sure if the python tiktoken library has the cl200k tokenizer for gpt-4o, but I would imagine it does. So this library does support gpt-4o at least.

Yes it does, and no it doesn't.

It is exactly as bad of a situation as I laid out.

It is a tiktoken wrapper that only does CL100K, doesn't bother with anything beyond that, even the message frame tokens, and claims to calculate cost for 400 LLMs.

Re: Show HN: Token price calculator for 400+ LLMs

#60

Earlier quoted context omitted.

> This is unnecessarily harsh. Which part? All I can tease out from your comment are "the lies are impossible" (agreed!) and "close enough afaik". (it's not, the closest in the Big 5 has percent error of 32% , see end of comment. ex. GPT4o has a tokenizer with 2x the vocab so you'd expect ~1/2 the tokens) > Not every model has a publicly available tokenizer, Right. Ex. Claude 3s and Geminis. So why are Claude 3s and…

I can tell you've never actually built anything worthwhile

Lol. Drive by insult that's A) obviously wrong, and funnily enough, it's the attention to detail that got me there B) in service of caping for "33% error in financial calculations is actually fine"
Post reply on HN