diff --git a/src/core/api/index.ts b/src/core/api/index.ts index d981d95c..1cb45d67 100644 --- a/src/core/api/index.ts +++ b/src/core/api/index.ts @@ -200,6 +200,8 @@ function createHandlerForProvider( deepSeekApiKey: options.deepSeekApiKey, apiModelId: mode === "plan" ? options.planModeApiModelId : options.actModeApiModelId, deepSeekModelInfo: mode === "plan" ? options.planModeDeepSeekModelInfo : options.actModeDeepSeekModelInfo, + thinkingBudgetTokens: + mode === "plan" ? options.planModeThinkingBudgetTokens : options.actModeThinkingBudgetTokens, }) case "requesty": return new RequestyHandler({ diff --git a/src/core/api/providers/deepseek.ts b/src/core/api/providers/deepseek.ts index d2ba935c..4b8fe507 100644 --- a/src/core/api/providers/deepseek.ts +++ b/src/core/api/providers/deepseek.ts @@ -16,6 +16,7 @@ interface DeepSeekHandlerOptions extends CommonApiHandlerOptions { deepSeekApiKey?: string apiModelId?: string deepSeekModelInfo?: ModelInfo + thinkingBudgetTokens?: number } export class DeepSeekHandler implements ApiHandler { @@ -98,6 +99,10 @@ export class DeepSeekHandler implements ApiHandler { stream_options: { include_usage: true }, // Only set temperature for non-thinking models ...(isDeepSeekThinkingModel ? {} : { temperature: 0 }), + // Limit thinking tokens to reduce verbose reasoning output + ...(isDeepSeekThinkingModel && this.options.thinkingBudgetTokens + ? { thinking_budget: this.options.thinkingBudgetTokens } + : {}), // Force tool usage for V4 thinking models to prevent text-only responses ...(tools?.length ? isDeepSeekThinkingModel diff --git a/src/shared/storage/state-keys.ts b/src/shared/storage/state-keys.ts index a50821ed..2fef8d1a 100644 --- a/src/shared/storage/state-keys.ts +++ b/src/shared/storage/state-keys.ts @@ -157,7 +157,7 @@ const API_HANDLER_SETTINGS_FIELDS = { // Plan mode configurations planModeApiModelId: { default: undefined as string | undefined }, - planModeThinkingBudgetTokens: { default: undefined as number | undefined }, + planModeThinkingBudgetTokens: { default: 4096 as number }, geminiPlanModeThinkingLevel: { default: undefined as string | undefined }, planModeReasoningEffort: { default: undefined as string | undefined }, planModeVerbosity: { default: undefined as string | undefined }, @@ -202,7 +202,7 @@ const API_HANDLER_SETTINGS_FIELDS = { // Act mode configurations actModeApiModelId: { default: undefined as string | undefined }, - actModeThinkingBudgetTokens: { default: undefined as number | undefined }, + actModeThinkingBudgetTokens: { default: 4096 as number }, geminiActModeThinkingLevel: { default: undefined as string | undefined }, actModeReasoningEffort: { default: undefined as string | undefined }, actModeVerbosity: { default: undefined as string | undefined },