From d9661222492a098555f40cb8b50014054bea5ab8 Mon Sep 17 00:00:00 2001 From: Tin Chi Lo Date: Fri, 17 Jul 2026 17:19:17 -0700 Subject: [PATCH] fix(fireworks_ai): correct glm-5p2 prompt-cache read price to $0.14/1M glm-5p2 (and its fireworks_ai/glm-5p2 alias) carried cache_read_input_token_cost of 2.6e-07, the GLM 5.1 rate; the entry was seeded from the wrong row. Fireworks' standard serverless rate for GLM 5.2 is $0.14/1M = 1.4e-07, so every prompt-cache hit was billed at nearly double the real rate. Corrects the value in both the canonical map and the bundled backup. The existing fireworks cost-calculator test now reads the cached rate from the map instead of hardcoding it, so it tracks the shipped value. --- litellm/model_prices_and_context_window_backup.json | 4 ++-- model_prices_and_context_window.json | 4 ++-- .../llms/fireworks_ai/test_fireworks_ai_cost_calculator.py | 5 ++++- tests/test_litellm/test_utils.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index ee996198b28..e5afc81b641 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -16272,7 +16272,7 @@ "supports_vision": false }, "fireworks_ai/accounts/fireworks/models/glm-5p2": { - "cache_read_input_token_cost": 2.6e-07, + "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.4e-06, "litellm_provider": "fireworks_ai", "max_input_tokens": 1048576, @@ -16686,7 +16686,7 @@ "supports_vision": false }, "fireworks_ai/glm-5p2": { - "cache_read_input_token_cost": 2.6e-07, + "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.4e-06, "litellm_provider": "fireworks_ai", "max_input_tokens": 1048576, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index b1a87c444c8..5cf99ba8bac 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -16272,7 +16272,7 @@ "supports_vision": false }, "fireworks_ai/accounts/fireworks/models/glm-5p2": { - "cache_read_input_token_cost": 2.6e-07, + "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.4e-06, "litellm_provider": "fireworks_ai", "max_input_tokens": 1048576, @@ -16686,7 +16686,7 @@ "supports_vision": false }, "fireworks_ai/glm-5p2": { - "cache_read_input_token_cost": 2.6e-07, + "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.4e-06, "litellm_provider": "fireworks_ai", "max_input_tokens": 1048576, diff --git a/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_cost_calculator.py b/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_cost_calculator.py index 99dcaa36c75..3297750fa6e 100644 --- a/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_cost_calculator.py +++ b/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_cost_calculator.py @@ -5,12 +5,15 @@ import pytest sys.path.insert(0, os.path.abspath("../../../../..")) +import litellm from litellm.llms.fireworks_ai.cost_calculator import cost_per_token from litellm.types.utils import PromptTokensDetailsWrapper, Usage MODEL = "accounts/fireworks/models/glm-5p2" INPUT_COST = 1.4e-06 -CACHE_READ_COST = 2.6e-07 +# Read the cached rate from the price map so this test tracks the shipped value +# (glm-5p2 is $0.14/1M) instead of hardcoding a number that breaks when it changes. +CACHE_READ_COST = litellm.get_model_info(model=MODEL, custom_llm_provider="fireworks_ai")["cache_read_input_token_cost"] OUTPUT_COST = 4.4e-06 diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index edd93cbebe0..a1a9448cc58 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -4317,7 +4317,7 @@ _FIREWORKS_MODELS = [ "accounts/fireworks/models/glm-5p2", 1.4e-06, 4.4e-06, - 2.6e-07, + 1.4e-07, 1048576, 131072, False,