[Bug]: Incorrect cost calculation when writing cached prompt tokens in Anthropic
Opened this issue · 0 comments
Gullesnuffs commented
What happened?
The cost calculation currently prices writing cached prompt tokens at $3.75 EXTRA per million tokens, for Claude 3.5 Sonnet. The cost is actually $3.75 instead of the normal prompt token cost (which is $3).
Relevant log output
poetry run python
Python 3.12.2 (main, Feb 6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from litellm.cost_calculator import cost_per_token
>>> cost_per_token("claude-3-5-sonnet-20241022", prompt_tokens=1000, completion_tokens=0)
(0.003, 0.0)
>>> cost_per_token("claude-3-5-sonnet-20241022", prompt_tokens=1000, completion_tokens=0, cache_creation_input_tokens=1000)
(0.006750000000000001, 0.0)
Twitter / LinkedIn details
No response