AgentOps-AI / tokencost

Easy token price estimates for 400+ LLMs. TokenOps.
https://agentops.ai
MIT License
1.25k stars 41 forks source link

Expose calculate_cost_by_tokens #50

Closed henrikhargedahl closed 2 weeks ago

henrikhargedahl commented 3 weeks ago

In my scenario I like to use calculate_cost_by_tokens directly through import but I cannot do that because it is not added in tokencost/init.py. I suggest adding that to make it even more flexible in its usage.

areibman commented 3 weeks ago

In my scenario I like to use calculate_cost_by_tokens directly through import but I cannot do that because it is not added in tokencost/init.py. I suggest adding that to make it even more flexible in its usage.

Sounds good/easy enough. Can you raise a PR for this?

henrikhargedahl commented 2 weeks ago

@areibman It's a very small change and of course I'd be happy to contribute. Could you add permissions to create a branch for this issue?

areibman commented 2 weeks ago

@areibman It's a very small change and of course I'd be happy to contribute. Could you add permissions to create a branch for this issue?

Easiest way to do this is to fork the repo, create a branch on your fork, and then raise a pull request to this repo's main branch. Let me know if this works (I'm away from desktop atm)

henrikhargedahl commented 2 weeks ago

Done!

areibman commented 2 weeks ago

Closed with #54, thanks @henrikhargedahl !