o
    ưi                     @   s:   d dl mZ d dlZd dlmZ dededefddZdS )	    )AnyN)ImageResponsemodelimage_responsereturnc                 C   sZ   t j| t jjjd}|dpd}d}t|tr$|jr t	|j}|| S t
dt| )z
    RunwayML image generation cost calculator.
    
    RunwayML charges per image generated, not per pixel.
    Pricing is stored in model_prices_and_context_window.json with output_cost_per_image.
    )r   Zcustom_llm_provideroutput_cost_per_imageg        r   z7image_response must be of type ImageResponse, got type=)litellmZget_model_infoZLlmProvidersZRUNWAYMLvalueget
isinstancer   datalen
ValueErrortype)r   r   Z_model_infor   Z
num_images r   \/home/app/Keep/.python/lib/python3.10/site-packages/litellm/llms/runwayml/cost_calculator.pycost_calculator   s   


r   )typingr   r   Zlitellm.types.utilsr   strfloatr   r   r   r   r   <module>   s    