langchain_nvidia_ai_endpoints.callbacks.get_token_cost_for_modelΒΆ
- langchain_nvidia_ai_endpoints.callbacks.get_token_cost_for_model(model_name: str, num_tokens: int, price_map: dict, is_completion: bool = False) float[source]ΒΆ
Get the cost in USD for a given model and number of tokens.
- Parameters
model_name (str) β Name of the model
num_tokens (int) β Number of tokens.
price_map (dict) β Map of model names to cost per 1000 tokens. Defaults to AI Foundation Endpoint pricing per https://www.together.ai/pricing.
is_completion (bool) β Whether the model is used for completion or not. Defaults to False.
- Returns
Cost in USD.
- Return type
float