o
    ưi                      @   sr   d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ 	dded	e	d
ee deeef fddZdS )zf
Helper util for handling azure openai-specific cost calculation
- e.g.: prompt caching, audio tokens
    )OptionalTuple)verbose_logger)generic_cost_per_token)Usage)get_model_info        modelusageresponse_time_msreturnc                 C   st   t | dd}d|v r3|d dur3|dur3td|  d|d d|  d}|d | d	 }||fS t| |dd
S )aU  
    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 caching and audio token information

    Returns:
        Tuple[float, float] - prompt_cost_in_usd, completion_cost_in_usd
    Zazure)r	   custom_llm_providerZoutput_cost_per_secondNz
For model=z - output_cost_per_second: z; response time: r   i  )r	   r
   r   )r   r   debuggetr   )r	   r
   r   Z
model_infoZprompt_costZcompletion_cost r   Z/home/app/Keep/.python/lib/python3.10/site-packages/litellm/llms/azure/cost_calculation.pycost_per_token   s   r   N)r   )__doc__typingr   r   Zlitellm._loggingr   Z.litellm.litellm_core_utils.llm_cost_calc.utilsr   Zlitellm.types.utilsr   Zlitellm.utilsr   strfloatr   r   r   r   r   <module>   s     
