Skip to content

The agent that grows with you

fix(deepseek): recognise the version-less deepseek-flash model id

YipTszkwan8435a3ae0017
diff --git a/agent/model_metadata.py b/agent/model_metadata.py
index 203ed32457a..402e925f74d 100644
--- a/agent/model_metadata.py
+++ b/agent/model_metadata.py
@@ -339,10 +339,12 @@ DEFAULT_CONTEXT_LENGTHS = {
# Google / Gemma ("gemma4" is Ollama-style naming, e.g. gemma4:31b-cloud)
"gemini": 1048576,
"gemma-4": 256000, "gemma4": 256000, "gemma-4-31b": 256000, "gemma-3": 131072, "gemma": 8192,
- # DeepSeek — V4 family is 1M; deepseek-chat/-reasoner alias v4-flash modes.
+ # DeepSeek — V4 family is 1M; deepseek-chat/-reasoner alias v4-flash modes. ``deepseek-flash``
+ # (version-less canonical id, 2026-09 Flash refresh) needs a discrete entry or the
+ # longest-key-first scan falls through to the 128K ``deepseek`` catch-all below.
# https://api-docs.deepseek.com/zh-cn/quick_start/pricing
"deepseek-v4-pro": 1_000_000, "deepseek-v4-flash": 1_000_000, "deepseek-chat": 1_000_000,
- "deepseek-reasoner": 1_000_000, "deepseek": 128000,
+ "deepseek-reasoner": 1_000_000, "deepseek-flash": 1_000_000, "deepseek": 128000,
# Meta; Muse Spark family (1.1/1.2/1.3, -contributor(-free), meta/ prefixed) is 1M per OpenRouter,
# models.dev and api.commandcode.ai /models — keep the "muse-spark" prefix (bare "muse" would match
# muse-image/muse-voice). Thinking Machines inkling (covers inkling-small and :free/:batch variants)
diff --git a/agent/reasoning_timeouts.py b/agent/reasoning_timeouts.py
index 76ae3511e16..4025bf91d38 100644
--- a/agent/reasoning_timeouts.py
+++ b/agent/reasoning_timeouts.py
@@ -20,7 +20,9 @@ _REASONING_STALE_TIMEOUT_FLOORS: dict[int, tuple[str, ...]] = {
# NVIDIA Nemotron behind hosted NIM: documented 60-180s upstream idle kill.
"nemotron-3-ultra", "nemotron-3-super",
# DeepSeek R1 / V4 (reasoning_content streamed before final content).
- "deepseek-r1", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro",
+ # ``deepseek-flash`` is the version-less canonical Flash id (2026-09 Flash refresh);
+ # ``deepseek-v4-flash`` still aliases onto it server-side.
+ "deepseek-r1", "deepseek-reasoner", "deepseek-flash", "deepseek-v4-flash", "deepseek-v4-pro",
# OpenAI o-series: each variant enumerated so bare ``o1`` cannot over-match ``olmo-1``.
"o1", "o1-mini", "o1-pro", "o1-preview", "o3", "o3-pro",
# Mythos-class named models (claude-fable-5): 1M ctx + 128K output, a heavier thinking
diff --git a/hermes_cli/model_normalize.py b/hermes_cli/model_normalize.py
index 3454a152826..4dbf09c1a22 100644
--- a/hermes_cli/model_normalize.py
+++ b/hermes_cli/model_normalize.py
@@ -92,8 +92,12 @@ _LOWERCASE_MODEL_PROVIDERS: frozenset[str] = frozenset({
_DEEPSEEK_RETIRED_ALIASES: frozenset[str] = frozenset({
"deepseek-chat", "deepseek-reasoner"})
+# ``deepseek-flash`` is the version-less canonical Flash id from the 2026-09 Flash refresh:
+# ``GET /v1/models`` reports it and the API accepts it directly. It carries no ``v<N>``
+# marker, so without an entry here it misses the V-series regex below and the id the user
+# picked is folded onto ``deepseek-v4-flash`` before it ever reaches the wire.
_DEEPSEEK_CANONICAL_MODELS: frozenset[str] = frozenset({
- "deepseek-v4-pro", "deepseek-v4-flash"})
+ "deepseek-v4-pro", "deepseek-v4-flash", "deepseek-flash"})
# 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``.
diff --git a/plugins/model-providers/deepseek/__init__.py b/plugins/model-providers/deepseek/__init__.py
index 27e49dc6233..cbdaef3b93a 100644
--- a/plugins/model-providers/deepseek/__init__.py
+++ b/plugins/model-providers/deepseek/__init__.py
@@ -15,6 +15,13 @@ from providers import register_provider
from providers.base import ProviderProfile
+# Version-less canonical ids for thinking-capable DeepSeek models. The 2026-09 Flash
+# refresh dropped the ``v<N>`` marker from the public id: ``GET /v1/models`` reports
+# ``deepseek-flash`` and the API accepts it directly, so the generation check in
+# ``build_api_kwargs_extras`` cannot recognise it.
+_THINKING_CAPABLE_IDS: frozenset[str] = frozenset({"deepseek-flash"})
+
+
class DeepSeekProfile(ProviderProfile):
"""DeepSeek — extra_body.thinking + top-level reasoning_effort."""
@@ -22,7 +29,12 @@ class DeepSeekProfile(ProviderProfile):
self, *, reasoning_config: dict | None = None, model: str | None = None, **context
) -> tuple[dict[str, Any], dict[str, Any]]:
m = (model or "").strip().lower()
- if not m.startswith("deepseek-v") or m.startswith("deepseek-v3"): # v4+ only; v3 excluded
+ # v4+ only; v3 excluded. Version-less canonicals (``deepseek-flash``) carry the
+ # same thinking-mode contract but no ``v<N>`` prefix, so consult the id set too —
+ # missing them makes Hermes omit ``thinking``, so the server defaults to on and
+ # the user's thinking toggle / effort setting is silently ignored.
+ versioned_v4_plus = m.startswith("deepseek-v") and not m.startswith("deepseek-v3")
+ if not versioned_v4_plus and m not in _THINKING_CAPABLE_IDS:
return {}, {}
rc = reasoning_config if isinstance(reasoning_config, dict) else None
# Always set thinking explicitly (default enabled, matching the API default)
diff --git a/tests/agent/test_model_metadata.py b/tests/agent/test_model_metadata.py
index 955b69a6e15..63ccc1bfbd3 100644
--- a/tests/agent/test_model_metadata.py
+++ b/tests/agent/test_model_metadata.py
@@ -358,6 +358,8 @@ class TestDefaultContextLengths:
"deepseek-v4-flash": 1_000_000,
"deepseek-chat": 1_000_000,
"deepseek-reasoner": 1_000_000,
+ # Version-less canonical Flash id (2026-09 Flash refresh).
+ "deepseek-flash": 1_000_000,
}
for key, value in expected_keys.items():
assert key in DEFAULT_CONTEXT_LENGTHS, f"{key} missing"
@@ -379,6 +381,8 @@ class TestDefaultContextLengths:
("deepseek/deepseek-v4-flash", 1_000_000),
("deepseek-chat", 1_000_000),
("deepseek-reasoner", 1_000_000),
+ ("deepseek-flash", 1_000_000),
+ ("deepseek/deepseek-flash", 1_000_000),
]
for model_id, expected_ctx in cases:
actual = get_model_context_length(model_id)
diff --git a/tests/agent/test_reasoning_stale_timeout_floor.py b/tests/agent/test_reasoning_stale_timeout_floor.py
index bb0e5b9d134..ac81ac44e28 100644
--- a/tests/agent/test_reasoning_stale_timeout_floor.py
+++ b/tests/agent/test_reasoning_stale_timeout_floor.py
@@ -56,6 +56,10 @@ import pytest
("deepseek/deepseek-v4-flash", 600.0),
("deepseek/deepseek-v4-pro", 600.0),
("deepseek-v4-flash-free", 600.0), # catalog -free variant inherits via separator anchor
+ # Version-less canonical Flash id from the 2026-09 Flash refresh —
+ # ``deepseek-v4-flash`` still aliases onto it server-side.
+ ("deepseek/deepseek-flash", 600.0),
+ ("deepseek-flash", 600.0),
# Qwen QwQ + Qwen3 thinking variants (qwen3 family entry matches all).
("qwen/qwq-32b-preview", 300.0),
("qwen/qwen3-235b-a22b-thinking", 180.0),
diff --git a/tests/hermes_cli/test_model_normalize.py b/tests/hermes_cli/test_model_normalize.py
index 765525fb2ba..4466c95d6d2 100644
--- a/tests/hermes_cli/test_model_normalize.py
+++ b/tests/hermes_cli/test_model_normalize.py
@@ -110,6 +110,21 @@ class TestDeepseekVSeriesPassThrough:
result = normalize_model_for_provider("deepseek-v4-pro", "deepseek")
assert result == "deepseek-v4-pro"
+ def test_deepseek_provider_preserves_versionless_flash_id(self):
+ """``deepseek-flash`` must reach DeepSeek's API unchanged.
+
+ DeepSeek's 2026-09 Flash refresh dropped the ``v<N>`` marker from the
+ public id: ``GET /v1/models`` reports ``deepseek-flash`` and the API
+ accepts it directly (verified live — it answers 200, and the older
+ ``deepseek-v4-flash`` is aliased onto it). Folding it onto
+ ``deepseek-v4-flash`` meant the id users picked never reached the wire
+ and the config stored a different model than the picker advertised.
+ """
+ assert (
+ normalize_model_for_provider("deepseek-flash", "deepseek")
+ == "deepseek-flash"
+ )
+
# ── DeepSeek post-2026-07-24 alias remapping ───────────────────────────
diff --git a/tests/plugins/model_providers/test_deepseek_profile.py b/tests/plugins/model_providers/test_deepseek_profile.py
index db974f61c09..69ccba21044 100644
--- a/tests/plugins/model_providers/test_deepseek_profile.py
+++ b/tests/plugins/model_providers/test_deepseek_profile.py
@@ -108,6 +108,10 @@ class TestDeepSeekModelGating:
"deepseek-v4-flash",
"deepseek-v4-future-variant",
"DEEPSEEK-V4-PRO", # case-insensitive
+ # Version-less canonical ids (2026-09 Flash refresh) carry the
+ # same thinking-mode contract but no v<N> marker.
+ "deepseek-flash",
+ "DEEPSEEK-FLASH", # case-insensitive
],
)
def test_thinking_capable_models_emit_thinking(self, deepseek_profile, model):