From 7dec138bda8068e43c7f45fb2bb9eba47801400c Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Thu, 20 Aug 2026 17:54:07 +0700 Subject: [PATCH] fix(modelregistry): expose reasoning effort for DeepSeek V4 models deepseek-v4-flash / deepseek-v4-pro expose thinking-mode effort control through the OpenAI-compatible reasoning_effort parameter (low/high/max; medium/xhigh map onto high). reasoningEffortsForModelName did not recognize the deepseek family, so /effort only offered 'auto' for these models. Advertise {low, high, max} so the /effort picker and Ctrl+T ring work, and add fallback coverage for deepseek-v4-flash/pro/reasoner/chat. --- internal/modelregistry/catalog.go | 6 ++++++ internal/modelregistry/effort_fallback_test.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/internal/modelregistry/catalog.go b/internal/modelregistry/catalog.go index ff36b606e..d8be171ca 100644 --- a/internal/modelregistry/catalog.go +++ b/internal/modelregistry/catalog.go @@ -231,6 +231,12 @@ func reasoningEffortsForModelName(name string) []ReasoningEffort { // the gateway's translation concern — unknown fields are ignored, so the // worst case is a silent no-op rather than a 400. return []ReasoningEffort{ReasoningEffortLow, ReasoningEffortMedium, ReasoningEffortHigh} + case strings.Contains(n, "deepseek"): + // DeepSeek V4 (deepseek-v4-flash / deepseek-v4-pro) exposes thinking-mode + // effort control through the OpenAI-compatible reasoning_effort parameter. + // The API accepts low/high/max and maps medium/xhigh onto high, so only + // the three distinct tiers are advertised. + return []ReasoningEffort{ReasoningEffortLow, ReasoningEffortHigh, ReasoningEffortMax} default: return nil } diff --git a/internal/modelregistry/effort_fallback_test.go b/internal/modelregistry/effort_fallback_test.go index f9fb3741f..6a3568bee 100644 --- a/internal/modelregistry/effort_fallback_test.go +++ b/internal/modelregistry/effort_fallback_test.go @@ -20,6 +20,10 @@ func TestReasoningEffortsFallbackForGPT5AndOSeries(t *testing.T) { {"hy3", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortMedium, ReasoningEffortHigh}}, {"hunyuan-t1", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortMedium, ReasoningEffortHigh}}, {"openai/o3-mini", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortMedium, ReasoningEffortHigh}}, // github-style vendor/ id + {"deepseek-v4-flash", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortHigh, ReasoningEffortMax}}, + {"deepseek-v4-pro", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortHigh, ReasoningEffortMax}}, + {"deepseek-reasoner", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortHigh, ReasoningEffortMax}}, + {"deepseek-chat", []ReasoningEffort{ReasoningEffortLow, ReasoningEffortHigh, ReasoningEffortMax}}, {"gpt-4.1", nil}, // non-reasoning, registered: stays empty {"gpt-4o-mini", nil}, {"ollama/llama3.1", nil},