From 66524a8ef2b0301d33ad0810778f973234826486 Mon Sep 17 00:00:00 2001 From: Dotify71 Date: Sun, 24 May 2026 16:29:06 +0530 Subject: [PATCH] fix(deepseek): remove duplicate entries and update backup registry to active discounted rates --- ...odel_prices_and_context_window_backup.json | 16 +++--- model_prices_and_context_window.json | 49 +------------------ tests/test_litellm/test_utils.py | 41 ++++++++++++++++ 3 files changed, 50 insertions(+), 56 deletions(-) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 15c52df5599..ae01a68969f 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -9911,7 +9911,7 @@ "supports_tool_choice": false }, "deepseek-v4-flash": { - "cache_read_input_token_cost": 1.4e-08, + "cache_read_input_token_cost": 2.8e-09, "input_cost_per_token": 1.4e-07, "litellm_provider": "deepseek", "max_input_tokens": 1000000, @@ -9927,12 +9927,12 @@ "supports_tool_choice": true }, "deepseek-v4-pro": { - "cache_read_input_token_cost": 1.74e-07, - "input_cost_per_token": 1.74e-06, + "cache_read_input_token_cost": 3.625e-09, + "input_cost_per_token": 4.35e-07, "litellm_provider": "deepseek", "max_input_tokens": 1000000, "mode": "chat", - "output_cost_per_token": 3.48e-06, + "output_cost_per_token": 8.7e-07, "source": "https://api-docs.deepseek.com/quick_start/pricing", "supports_function_calling": true, "supports_native_streaming": true, @@ -12533,7 +12533,7 @@ "supports_tool_choice": true }, "deepseek/deepseek-v4-flash": { - "cache_read_input_token_cost": 1.4e-08, + "cache_read_input_token_cost": 2.8e-09, "input_cost_per_token": 1.4e-07, "litellm_provider": "deepseek", "max_input_tokens": 1000000, @@ -12549,12 +12549,12 @@ "supports_tool_choice": true }, "deepseek/deepseek-v4-pro": { - "cache_read_input_token_cost": 1.74e-07, - "input_cost_per_token": 1.74e-06, + "cache_read_input_token_cost": 3.625e-09, + "input_cost_per_token": 4.35e-07, "litellm_provider": "deepseek", "max_input_tokens": 1000000, "mode": "chat", - "output_cost_per_token": 3.48e-06, + "output_cost_per_token": 8.7e-07, "source": "https://api-docs.deepseek.com/quick_start/pricing", "supports_function_calling": true, "supports_native_streaming": true, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index cf4b252b326..2f9367401d7 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -12501,54 +12501,7 @@ "supports_reasoning": true, "supports_tool_choice": true }, - "deepseek/deepseek-v4-flash": { - "cache_creation_input_token_cost": 0.0, - "cache_read_input_token_cost": 1.4e-08, - "input_cost_per_token": 1.4e-07, - "input_cost_per_token_cache_hit": 1.4e-08, - "litellm_provider": "deepseek", - "max_input_tokens": 1000000, - "max_output_tokens": 8192, - "max_tokens": 8192, - "mode": "chat", - "output_cost_per_token": 2.8e-07, - "source": "https://api-docs.deepseek.com/quick_start/pricing", - "supported_endpoints": [ - "/v1/chat/completions" - ], - "supports_assistant_prefill": true, - "supports_function_calling": true, - "supports_native_streaming": true, - "supports_parallel_function_calling": true, - "supports_prompt_caching": true, - "supports_response_schema": true, - "supports_system_messages": true, - "supports_tool_choice": true - }, - "deepseek/deepseek-v4-pro": { - "cache_creation_input_token_cost": 0.0, - "cache_read_input_token_cost": 1.74e-07, - "input_cost_per_token": 1.74e-06, - "input_cost_per_token_cache_hit": 1.74e-07, - "litellm_provider": "deepseek", - "max_input_tokens": 1000000, - "max_output_tokens": 8192, - "max_tokens": 8192, - "mode": "chat", - "output_cost_per_token": 3.48e-06, - "source": "https://api-docs.deepseek.com/quick_start/pricing", - "supported_endpoints": [ - "/v1/chat/completions" - ], - "supports_assistant_prefill": true, - "supports_function_calling": true, - "supports_native_streaming": true, - "supports_parallel_function_calling": true, - "supports_prompt_caching": true, - "supports_response_schema": true, - "supports_system_messages": true, - "supports_tool_choice": true - }, + "deepseek/deepseek-reasoner": { "cache_read_input_token_cost": 2.8e-08, "input_cost_per_token": 2.8e-07, diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index 0107221327a..3407e516bf8 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -4034,3 +4034,44 @@ def test_deepseek_v4_models_in_cost_map(): assert info["supports_function_calling"] is True assert info["supports_tool_choice"] is True + +def test_deepseek_v4_models_in_backup_cost_map(): + """ + Test that deepseek-v4-flash and deepseek-v4-pro entries are correctly + configured in litellm/model_prices_and_context_window_backup.json. + """ + import json + from pathlib import Path + + json_path = Path(__file__).parents[2] / "litellm" / "model_prices_and_context_window_backup.json" + with open(json_path) as f: + model_cost = json.load(f) + + # --- bare model names --- + for key, expected_input, expected_output, expected_cache in [ + ("deepseek-v4-flash", 1.4e-07, 2.8e-07, 2.8e-09), + ("deepseek-v4-pro", 4.35e-07, 8.7e-07, 3.625e-09), + ]: + info = model_cost.get(key) + assert info is not None, f"{key} missing from backup JSON" + assert info["litellm_provider"] == "deepseek" + assert info["mode"] == "chat" + assert info["input_cost_per_token"] == expected_input + assert info["output_cost_per_token"] == expected_output + assert info["cache_read_input_token_cost"] == expected_cache + assert info["max_input_tokens"] == 1_000_000 + + # --- provider-prefixed names --- + for key, expected_input, expected_output, expected_cache in [ + ("deepseek/deepseek-v4-flash", 1.4e-07, 2.8e-07, 2.8e-09), + ("deepseek/deepseek-v4-pro", 4.35e-07, 8.7e-07, 3.625e-09), + ]: + info = model_cost.get(key) + assert info is not None, f"{key} missing from backup JSON" + assert info["litellm_provider"] == "deepseek" + assert info["mode"] == "chat" + assert info["input_cost_per_token"] == expected_input + assert info["output_cost_per_token"] == expected_output + assert info["cache_read_input_token_cost"] == expected_cache + +