Liman

token_pricing

attributelogger
= logging.getLogger(__name__)
attributeDEFAULT
= calculate_token_price(1, 0, 4.5)
attributeGPT_4_1
= calculate_token_price(2, 0.5, 8)
attributeGPT_4_1_MINI
= calculate_token_price(0.4, 0.1, 1.6)
attributeGPT_4_1_NANO
= calculate_token_price(0.1, 0.025, 0.4)
attributeGPT_4_5_PREVIEW
= calculate_token_price(75, 37.5, 150)
attributeGPT_4O
= calculate_token_price(2.5, 1.25, 10)
attributeGTP_4O_AUDIO_PREVIEW
= calculate_token_price(2.5, 0, 10)
attributeGPT_4O_REALTIME_PREVIEW
= calculate_token_price(5, 2.5, 20)
attributeGPT_4O_MINI
= calculate_token_price(0.15, 0.075, 0.6)
attributeGPT_4O_MINI_AUDIO_PREVIEW
= calculate_token_price(0.15, 0, 0.6)
attributeGPT_4O_MINI_REALTIME_PREVIEW
= calculate_token_price(0.6, 0.3, 2.4)
attributeGPT_3_5_TURBO
= calculate_token_price(0.5, 0, 1.5)
funccalculate_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).

paraminput_tokensfloat
paramcached_tokensfloat
paramoutput_tokensfloat

Returns

tuple[float, float, float]
funcget_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).

parammodel_namestr

Returns

tuple[float, float, float]

Last updated on