Skip to content

Commit

Permalink
Merge pull request BerriAI#4087 from BerriAI/litellm_update_together_…
Browse files Browse the repository at this point in the history
…ai_pricing

Update together ai pricing
  • Loading branch information
krrishdholakia authored Jun 9, 2024
2 parents 78dbb15 + f3a845e commit 90ae7f0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 30 deletions.
22 changes: 12 additions & 10 deletions litellm/cost_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 12 additions & 7 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions litellm/tests/test_completion_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
19 changes: 12 additions & 7 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 90ae7f0

Please sign in to comment.