AgentOps-AI / tokencost

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

added calculate_cost_by_tokens - the case when token count is available #25

Closed nikilp closed 10 months ago

nikilp commented 10 months ago

This covers the case when a the response from the LLM already contains the total token count, thus it doesn't need to be calculated from the prompt or the completion again.

Especially useful when the underlying embeddings model is not available for correct calculation, while the response already has the counts.