From 332a0f1b9b1111a30301130b43411573a7fd971f Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 20 Aug 2026 17:33:59 -0700 Subject: [PATCH] fix(cognition): price swe-1.7 from the published standard tier The swe-1.7 rates were carried over from the closed prior attempt and match SWE-1.7 Lightning, 5x the SWE-1.7 Max and Medium rates the vendor publishes. swe-1.6 was already on the standard tier, so the two entries disagreed with each other. Both now read 0.5 in, 2.5 out, 0.2 cached per million tokens. Also drops the redundant registry comment in constants.py. --- litellm/constants.py | 2 +- litellm/model_prices_and_context_window_backup.json | 6 +++--- model_prices_and_context_window.json | 6 +++--- .../llms/openai_like/test_cognition_provider.py | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/litellm/constants.py b/litellm/constants.py index ccbeb260a83..c25e1b9eb31 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -831,7 +831,7 @@ openai_compatible_providers: Final[list] = [ "pinstripes", # Pinstripes - JSON-configured provider "darkbloom", "meta", # Meta Model API (Muse Spark) - JSON-configured provider - "cognition", # Cognition - JSON-configured provider + "cognition", ] openai_text_completion_compatible_providers: Final[list] = [ # providers that support `/v1/completions` "together_ai", diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 5d859a05963..d63a888ae9c 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -48486,9 +48486,9 @@ "source": "https://docs.devin.ai/windsurf/plugins/cascade/models" }, "cognition/swe-1.7": { - "input_cost_per_token": 2.5e-06, - "output_cost_per_token": 1.25e-05, - "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 5e-07, + "output_cost_per_token": 2.5e-06, + "cache_read_input_token_cost": 2e-07, "litellm_provider": "cognition", "mode": "chat", "supports_function_calling": true, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 5d859a05963..d63a888ae9c 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -48486,9 +48486,9 @@ "source": "https://docs.devin.ai/windsurf/plugins/cascade/models" }, "cognition/swe-1.7": { - "input_cost_per_token": 2.5e-06, - "output_cost_per_token": 1.25e-05, - "cache_read_input_token_cost": 1e-06, + "input_cost_per_token": 5e-07, + "output_cost_per_token": 2.5e-06, + "cache_read_input_token_cost": 2e-07, "litellm_provider": "cognition", "mode": "chat", "supports_function_calling": true, diff --git a/tests/test_litellm/llms/openai_like/test_cognition_provider.py b/tests/test_litellm/llms/openai_like/test_cognition_provider.py index 26bdfa82944..6dcc02387cc 100644 --- a/tests/test_litellm/llms/openai_like/test_cognition_provider.py +++ b/tests/test_litellm/llms/openai_like/test_cognition_provider.py @@ -114,7 +114,7 @@ class TestCognitionCostTracking: "model, input_cost, output_cost", [ ("cognition/swe-1.6", 5e-07, 2.5e-06), - ("cognition/swe-1.7", 2.5e-06, 1.25e-05), + ("cognition/swe-1.7", 5e-07, 2.5e-06), ], ) def test_cost_map_entries(self, model: str, input_cost: float, output_cost: float): @@ -136,8 +136,8 @@ class TestCognitionCostTracking: custom_llm_provider="cognition", ) - assert prompt_cost == pytest.approx(2.5) - assert completion_cost == pytest.approx(12.5) + assert prompt_cost == pytest.approx(0.5) + assert completion_cost == pytest.approx(2.5) def test_supported_endpoints_matrix(self): matrix = json.loads((Path(litellm.__file__).parent / "provider_endpoints_support_backup.json").read_text()) @@ -169,5 +169,5 @@ class TestCognitionRouting: ) usage = response.usage - expected = usage.prompt_tokens * 2.5e-06 + usage.completion_tokens * 1.25e-05 + expected = usage.prompt_tokens * 5e-07 + usage.completion_tokens * 2.5e-06 assert response._hidden_params["response_cost"] == pytest.approx(expected)