token_pricing
attribute
logger= logging.getLogger(__name__)
attribute
DEFAULT= calculate_token_price(1, 0, 4.5)
attribute
GPT_4_1= calculate_token_price(2, 0.5, 8)
attribute
GPT_4_1_MINI= calculate_token_price(0.4, 0.1, 1.6)
attribute
GPT_4_1_NANO= calculate_token_price(0.1, 0.025, 0.4)
attribute
GPT_4_5_PREVIEW= calculate_token_price(75, 37.5, 150)
attribute
GPT_4O= calculate_token_price(2.5, 1.25, 10)
attribute
GTP_4O_AUDIO_PREVIEW= calculate_token_price(2.5, 0, 10)
attribute
GPT_4O_REALTIME_PREVIEW= calculate_token_price(5, 2.5, 20)
attribute
GPT_4O_MINI= calculate_token_price(0.15, 0.075, 0.6)
attribute
GPT_4O_MINI_AUDIO_PREVIEW= calculate_token_price(0.15, 0, 0.6)
attribute
GPT_4O_MINI_REALTIME_PREVIEW= calculate_token_price(0.6, 0.3, 2.4)
attribute
GPT_3_5_TURBO= calculate_token_price(0.5, 0, 1.5)
func
calculate_token_pricecalculate_token_price(input_tokens, /, cached_tokens, output_tokens) -> tuple[float, float, float]
Calculate the token price based on the number of tokens.
Returns a tuple of (input_token_price, output_token_price, cached_token_price).
param
input_tokensfloat
param
cached_tokensfloat
param
output_tokensfloat
Returns
tuple[float, float, float]
func
get_token_priceget_token_price(model_name) -> tuple[float, float, float]
Get the token price for the specified model.
Returns a tuple of (input_token_price, output_token_price, cached_token_price).
param
model_namestr
Returns
tuple[float, float, float]
Last updated on