From e6e18d406a9a4e138f45ec6b9056d320e838d608 Mon Sep 17 00:00:00 2001 From: Akash Naickar Date: Thu, 6 Aug 2026 05:07:44 +0530 Subject: [PATCH] fix(model-prices): correct replicate model key typo (#34800) --- ...odel_prices_and_context_window_backup.json | 2 +- model_prices_and_context_window.json | 2 +- .../test_replicate_model_key_format.py | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 tests/test_litellm/test_replicate_model_key_format.py diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 02b3cde217a..1fb56a85923 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -33052,7 +33052,7 @@ "supports_tool_choice": true, "supports_response_schema": true }, - "replicateopenai/gpt-oss-20b": { + "replicate/openai/gpt-oss-20b": { "input_cost_per_token": 9e-08, "output_cost_per_token": 3.6e-07, "litellm_provider": "replicate", diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index bc7330ec99c..8ef0116416d 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -33143,7 +33143,7 @@ "supports_tool_choice": true, "supports_response_schema": true }, - "replicateopenai/gpt-oss-20b": { + "replicate/openai/gpt-oss-20b": { "input_cost_per_token": 9e-08, "output_cost_per_token": 3.6e-07, "litellm_provider": "replicate", diff --git a/tests/test_litellm/test_replicate_model_key_format.py b/tests/test_litellm/test_replicate_model_key_format.py new file mode 100644 index 00000000000..8c2b72f8ed2 --- /dev/null +++ b/tests/test_litellm/test_replicate_model_key_format.py @@ -0,0 +1,43 @@ +import json +from pathlib import Path +from typing import Any + +import pytest + + +@pytest.fixture() +def model_cost() -> dict[str, Any]: + json_path = Path(__file__).parents[2] / "model_prices_and_context_window.json" + with open(json_path, encoding="utf-8") as f: + return json.load(f) + + +def test_replicate_models_have_valid_key_prefix(model_cost: dict[str, Any]) -> None: + replicate_models = {k for k, v in model_cost.items() if v.get("litellm_provider") == "replicate"} + malformed = [k for k in replicate_models if not k.startswith("replicate/")] + assert not malformed, ( + f"Replicate models must use 'replicate/owner/model' key format, found malformed keys: {malformed}" + ) + + +def test_replicate_openai_gpt_oss_20b_key_exists(model_cost: dict[str, Any]) -> None: + assert "replicate/openai/gpt-oss-20b" in model_cost + info = model_cost["replicate/openai/gpt-oss-20b"] + assert info["litellm_provider"] == "replicate" + assert info["mode"] == "chat" + assert info["supports_function_calling"] is True + + +def test_replicate_backup_matches_main() -> None: + repo_root = Path(__file__).parents[2] + main_path = repo_root / "model_prices_and_context_window.json" + backup_path = repo_root / "litellm" / "model_prices_and_context_window_backup.json" + + with open(main_path, encoding="utf-8") as f: + main_cost: dict[str, Any] = json.load(f) + with open(backup_path, encoding="utf-8") as f: + backup_cost: dict[str, Any] = json.load(f) + + for key in main_cost: + if main_cost[key].get("litellm_provider") == "replicate": + assert backup_cost.get(key) == main_cost.get(key), f"{key} differs between main and backup model cost maps"