fix(deepseek): remap retired chat/reasoner aliases to v4-flash

DeepSeek cut off deepseek-chat and deepseek-reasoner on 2026-07-24.
Sending those IDs now returns HTTP 400; rewrite them (and fuzzy
reasoner names) to deepseek-v4-flash so saved configs keep working.
This commit is contained in:
HexLab98 2026-07-25 12:33:16 +07:00 committed by Teknium
parent 148497f6d6
commit cc7c418b33
2 changed files with 58 additions and 25 deletions

View file

@ -232,19 +232,33 @@ class TestDeepseekVSeriesPassThrough:
assert result == "deepseek-v4-flash"
# ── DeepSeek regressions (existing behaviour still holds) ──────────────
# ── DeepSeek post-2026-07-24 alias remapping ───────────────────────────
class TestDeepseekCanonicalAndReasonerMapping:
"""Canonical pass-through and reasoner-keyword folding stay intact."""
"""Retired aliases and fuzzy names rewrite to deepseek-v4-flash.
DeepSeek cut off ``deepseek-chat`` / ``deepseek-reasoner`` on
2026-07-24; sending them on the wire returns HTTP 400.
"""
@pytest.mark.parametrize("model,expected", [
("deepseek-chat", "deepseek-chat"),
("deepseek-reasoner", "deepseek-reasoner"),
("DEEPSEEK-CHAT", "deepseek-chat"),
("deepseek-chat", "deepseek-v4-flash"),
("deepseek-reasoner", "deepseek-v4-flash"),
("DEEPSEEK-CHAT", "deepseek-v4-flash"),
("DEEPSEEK-REASONER", "deepseek-v4-flash"),
("deepseek/deepseek-reasoner", "deepseek-v4-flash"),
("deepseek-v4-pro", "deepseek-v4-pro"),
("deepseek-v4-flash", "deepseek-v4-flash"),
])
def test_canonical_models_pass_through(self, model, expected):
def test_retired_aliases_and_canonicals(self, model, expected):
assert _normalize_for_deepseek(model) == expected
def test_provider_path_rewrites_reasoner(self):
assert (
normalize_model_for_provider("deepseek-reasoner", "deepseek")
== "deepseek-v4-flash"
)
@pytest.mark.parametrize("model", [
"deepseek-r1",
"deepseek-r1-0528",
@ -252,8 +266,8 @@ class TestDeepseekCanonicalAndReasonerMapping:
"deepseek-reasoning-preview",
"deepseek-cot-experimental",
])
def test_reasoner_keywords_map_to_reasoner(self, model):
assert _normalize_for_deepseek(model) == "deepseek-reasoner"
def test_reasoner_keywords_map_to_v4_flash(self, model):
assert _normalize_for_deepseek(model) == "deepseek-v4-flash"
@pytest.mark.parametrize("model", [
"deepseek-chat-v3.1", # 'chat' prefix, not V-series pattern
@ -261,5 +275,5 @@ class TestDeepseekCanonicalAndReasonerMapping:
"something-random",
"gpt-5", # non-DeepSeek names still fall through
])
def test_unknown_names_fall_back_to_chat(self, model):
assert _normalize_for_deepseek(model) == "deepseek-chat"
def test_unknown_names_fall_back_to_v4_flash(self, model):
assert _normalize_for_deepseek(model) == "deepseek-v4-flash"