Skip to content

The agent that grows with you

fix(deepseek): pass custom model ids through instead of rewriting them

Teknium6964eebd3508
diff --git a/hermes_cli/model_normalize.py b/hermes_cli/model_normalize.py
index fe05f79670a..8c990e7038d 100644
--- a/hermes_cli/model_normalize.py
+++ b/hermes_cli/model_normalize.py
@@ -86,32 +86,19 @@ _CATALOGUE_PREFIX_REPAIR_PROVIDERS: frozenset[str] = frozenset({
_LOWERCASE_MODEL_PROVIDERS: frozenset[str] = frozenset({
"xiaomi"})
-# DeepSeek's direct API only accepts first-class ids after the 2026-07-24 cut-off (HTTP 400
-# otherwise). Retired aliases fold onto the version-less ``deepseek-flash`` (V4.1-Flash, 2026-09-10;
-# thinking mode is controlled by extra_body.thinking on the profile), so saved configs can't keep
-# sending them.
-_DEEPSEEK_RETIRED_ALIASES: frozenset[str] = frozenset({
- "deepseek-chat", "deepseek-reasoner"})
-
-# ``deepseek-flash`` carries no ``v<N>`` marker, so it needs an entry here or the V-series regex
-# below misses it and the id the user picked is rewritten before it reaches the wire.
-_DEEPSEEK_CANONICAL_MODELS: frozenset[str] = frozenset({
- "deepseek-flash", "deepseek-v4-pro"})
-
-# First-class V-series IDs incl. future ``deepseek-v5-*`` and dated variants
-# (``deepseek-v4-flash-20260423``): verified real model ids, NOT aliases of ``deepseek-chat``.
-_DEEPSEEK_V_SERIES_RE = re.compile(r"^deepseek-v\d+([-.].+)?$")
+# DeepSeek retired ``deepseek-chat`` / ``deepseek-reasoner`` on 2026-07-24 (HTTP 400 since); saved
+# configs still carry them, so they fold onto the current Flash id (thinking mode is controlled by
+# extra_body.thinking on the profile). Every other id is the user's call and goes to the wire as typed:
+# a shape-based allow-list swallowed the vendor's own ``deepseek-flash`` the day it shipped (#107206),
+# and any new id without a ``v<N>`` marker would have met the same fate.
+_DEEPSEEK_RETIRED_ALIASES: dict[str, str] = {
+ "deepseek-chat": "deepseek-flash", "deepseek-reasoner": "deepseek-flash"}
def _normalize_for_deepseek(model_name: str) -> str:
- """Map a model input to a DeepSeek-accepted id: canonicals and ``deepseek-v<digit>…`` pass
- through (dated variants and future V-series work without a release); retired aliases and other
- ``deepseek-*`` spellings become ``deepseek-flash``. Names outside the family pass through
- untouched so the validator can reject them instead of silently running Flash."""
+ """Fold retired DeepSeek aliases onto their replacement; pass everything else through."""
bare = _strip_vendor_prefix(model_name).lower()
- if bare in _DEEPSEEK_CANONICAL_MODELS or _DEEPSEEK_V_SERIES_RE.match(bare):
- return bare
- return "deepseek-flash" if bare.startswith("deepseek") else bare
+ return _DEEPSEEK_RETIRED_ALIASES.get(bare, bare)
def _strip_vendor_prefix(model_name: str) -> str:
diff --git a/tests/hermes_cli/test_model_normalize.py b/tests/hermes_cli/test_model_normalize.py
index 18b08199d20..fc181bfb532 100644
--- a/tests/hermes_cli/test_model_normalize.py
+++ b/tests/hermes_cli/test_model_normalize.py
@@ -128,13 +128,9 @@ class TestDeepseekVSeriesPassThrough:
# ── DeepSeek post-2026-07-24 alias remapping ───────────────────────────
-class TestDeepseekCanonicalAndReasonerMapping:
- """Retired aliases and fuzzy names rewrite to deepseek-flash.
-
- DeepSeek cut off ``deepseek-chat`` / ``deepseek-reasoner`` on
- 2026-07-24; sending them on the wire returns HTTP 400.
- """
-
+class TestDeepseekRetiredAliasesAndCustomSlugs:
+ """Only the two retired aliases are rewritten; every other id is the user's and reaches the
+ wire as typed (a shape allow-list swallowed the vendor's own ``deepseek-flash``, #107206)."""
def test_provider_path_rewrites_reasoner(self):
assert (
@@ -143,14 +139,14 @@ class TestDeepseekCanonicalAndReasonerMapping:
)
@pytest.mark.parametrize("model", [
+ "deepseek-v4.1-flash",
+ "deepseek-v4-flash-0731",
"deepseek-r1",
- "deepseek-r1-0528",
- "deepseek-think-v3",
- "deepseek-reasoning-preview",
- "deepseek-cot-experimental",
+ "deepseek-next-preview",
+ "my-fine-tune",
])
- def test_reasoner_keywords_map_to_flash(self, model):
- assert _normalize_for_deepseek(model) == "deepseek-flash"
+ def test_unknown_ids_pass_through_untouched(self, model):
+ assert _normalize_for_deepseek(model) == model
# ── Regression: issue #78796 ───────────────────────────────────────────