
    ^h/                     L    S r SSKJr  SSKJr  SSKJr  S\S\S\\\4   4S jr	g	)
zU
Helper util for handling anthropic-specific cost calculation
- e.g.: prompt caching
    )Tuple)Usage)get_model_infomodelusagereturnc                 (   [        U SS9nSnUR                  nSnUR                  (       a5  UR                  R                  (       a  UR                  R                  nXE-
  n[	        U5      US   -  nUR                  S5      nUbQ  UR                  (       a@  UR                  R                  (       a%  U[	        UR                  R                  5      U-  -  nUR                  S5      nUb  U[	        UR                  5      U-  -  nUS   US	   -  nX84$ )
a3  
Calculates the cost per token for a given model, prompt tokens, and completion tokens.

Input:
    - model: str, the model name without provider prefix
    - usage: LiteLLM Usage block, containing anthropic caching information

Returns:
    Tuple[float, float] - prompt_cost_in_usd, completion_cost_in_usd
	anthropic)r   custom_llm_providerg        r   input_cost_per_tokencache_read_input_token_costcache_creation_input_token_costcompletion_tokensoutput_cost_per_token)r   prompt_tokensprompt_tokens_detailscached_tokensfloatget_cache_creation_input_tokens)	r   r   
model_infoprompt_costnon_cache_hit_tokenscache_hit_tokens_cache_read_input_token_cost _cache_creation_input_token_costcompletion_costs	            a/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/anthropic/cost_calculation.pycost_per_tokenr      s     eMJ K ..""u'B'B'P'P 66DD3F,-
;Q0RRK#->>2O#P $0''''55%--;;<*+	
 (2~~6W'X$'3%4458XX	

 /0:>U3VVO''    N)
__doc__typingr   litellm.types.utilsr   litellm.utilsr   strr   r    r    r   <module>r'      s8   
  % (/(# /(e /(eUl0C /(r    