diff --git a/litellm/llms/together_ai.py b/litellm/llms/together_ai.py index e8a74724b..d4b85e9ca 100644 --- a/litellm/llms/together_ai.py +++ b/litellm/llms/together_ai.py @@ -215,7 +215,7 @@ def completion( "choices" ][0]["finish_reason"] model_response["created"] = int(time.time()) - model_response["model"] = model + model_response["model"] = "together_ai/" + model usage = Usage( prompt_tokens=prompt_tokens, completion_tokens=completion_tokens, diff --git a/litellm/utils.py b/litellm/utils.py index af926d362..397231448 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2644,7 +2644,7 @@ def completion_cost( completion_tokens = token_counter(model=model, text=completion) # Calculate cost based on prompt_tokens, completion_tokens - if "togethercomputer" in model: + if "togethercomputer" in model or "together_ai" in model: # together ai prices based on size of llm # get_model_params_and_category takes a model name and returns the category of LLM size it is in model_prices_and_context_window.json model = get_model_params_and_category(model) @@ -2661,7 +2661,8 @@ def completion_cost( completion_tokens=completion_tokens, ) return prompt_tokens_cost_usd_dollar + completion_tokens_cost_usd_dollar - except: + except Exception as e: + print_verbose(f"LiteLLM: Excepton when cost calculating {str(e)}") return 0.0 # this should not block a users execution path