diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index e90868da6..9a763d63e 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -42,16 +42,18 @@ def get_model_params_and_category(model_name) -> str: else: return model_name # Determine the category based on the number of parameters - if params_billion <= 3.0: - category = "together-ai-up-to-3b" - elif params_billion <= 7.0: - category = "together-ai-3.1b-7b" - elif params_billion <= 20.0: - category = "together-ai-7.1b-20b" - elif params_billion <= 40.0: - category = "together-ai-20.1b-40b" - elif params_billion <= 70.0: - category = "together-ai-40.1b-70b" + if params_billion <= 4.0: + category = "together-ai-up-to-4b" + elif params_billion <= 8.0: + category = "together-ai-4.1b-8b" + elif params_billion <= 21.0: + category = "together-ai-8.1b-21b" + elif params_billion <= 41.0: + category = "together-ai-21.1b-41b" + elif params_billion <= 80.0: + category = "together-ai-41.1b-80b" + elif params_billion <= 110.0: + category = "together-ai-81.1b-110b" if category is not None: return category diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 3fe089a6b..f2b292c92 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -3009,32 +3009,37 @@ "litellm_provider": "sagemaker", "mode": "chat" }, - "together-ai-up-to-3b": { + "together-ai-up-to-4b": { "input_cost_per_token": 0.0000001, "output_cost_per_token": 0.0000001, "litellm_provider": "together_ai" }, - "together-ai-3.1b-7b": { + "together-ai-4.1b-8b": { "input_cost_per_token": 0.0000002, "output_cost_per_token": 0.0000002, "litellm_provider": "together_ai" }, - "together-ai-7.1b-20b": { + "together-ai-8.1b-21b": { "max_tokens": 1000, - "input_cost_per_token": 0.0000004, - "output_cost_per_token": 0.0000004, + "input_cost_per_token": 0.0000003, + "output_cost_per_token": 0.0000003, "litellm_provider": "together_ai" }, - "together-ai-20.1b-40b": { + "together-ai-21.1b-41b": { "input_cost_per_token": 0.0000008, "output_cost_per_token": 0.0000008, "litellm_provider": "together_ai" }, - "together-ai-40.1b-70b": { + "together-ai-41.1b-80b": { "input_cost_per_token": 0.0000009, "output_cost_per_token": 0.0000009, "litellm_provider": "together_ai" }, + "together-ai-81.1b-110b": { + "input_cost_per_token": 0.0000018, + "output_cost_per_token": 0.0000018, + "litellm_provider": "together_ai" + }, "together_ai/mistralai/Mixtral-8x7B-Instruct-v0.1": { "input_cost_per_token": 0.0000006, "output_cost_per_token": 0.0000006, diff --git a/litellm/tests/test_completion_cost.py b/litellm/tests/test_completion_cost.py index 1f0dc1fc1..c0be350f9 100644 --- a/litellm/tests/test_completion_cost.py +++ b/litellm/tests/test_completion_cost.py @@ -560,9 +560,8 @@ def test_together_ai_qwen_completion_cost(): "custom_cost_per_second": None, } - try: - litellm.completion_cost(**input_kwargs) - except litellm.NotFoundError: - pass - except Exception: - pytest.fail("This should have returned a 'not found error'") + response = litellm.cost_calculator.get_model_params_and_category( + model_name="qwen/Qwen2-72B-Instruct" + ) + + assert response == "together-ai-41.1b-80b" diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 3fe089a6b..f2b292c92 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -3009,32 +3009,37 @@ "litellm_provider": "sagemaker", "mode": "chat" }, - "together-ai-up-to-3b": { + "together-ai-up-to-4b": { "input_cost_per_token": 0.0000001, "output_cost_per_token": 0.0000001, "litellm_provider": "together_ai" }, - "together-ai-3.1b-7b": { + "together-ai-4.1b-8b": { "input_cost_per_token": 0.0000002, "output_cost_per_token": 0.0000002, "litellm_provider": "together_ai" }, - "together-ai-7.1b-20b": { + "together-ai-8.1b-21b": { "max_tokens": 1000, - "input_cost_per_token": 0.0000004, - "output_cost_per_token": 0.0000004, + "input_cost_per_token": 0.0000003, + "output_cost_per_token": 0.0000003, "litellm_provider": "together_ai" }, - "together-ai-20.1b-40b": { + "together-ai-21.1b-41b": { "input_cost_per_token": 0.0000008, "output_cost_per_token": 0.0000008, "litellm_provider": "together_ai" }, - "together-ai-40.1b-70b": { + "together-ai-41.1b-80b": { "input_cost_per_token": 0.0000009, "output_cost_per_token": 0.0000009, "litellm_provider": "together_ai" }, + "together-ai-81.1b-110b": { + "input_cost_per_token": 0.0000018, + "output_cost_per_token": 0.0000018, + "litellm_provider": "together_ai" + }, "together_ai/mistralai/Mixtral-8x7B-Instruct-v0.1": { "input_cost_per_token": 0.0000006, "output_cost_per_token": 0.0000006,