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).
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).