AgentOps-AI / tokencost

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

Calculate the cost given the input/output token counts. #26

Closed nikilp closed 9 months ago

nikilp commented 10 months ago

I find it useful to be able to directly calculate the cost of prompt and completion when the token count is available in the completion response, rather that recalculating them. I've proposed a PR #25 which adds function calculate_cost_by_tokens(num_tokens: int, model: str, token_type: str).

areibman commented 9 months ago

Closed, thank you for your help @nikilp 🫡