Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: omit DeepSeek reasoning effort when disabled (#14194)

YuTengjing8b22e552715a
diff --git a/packages/model-runtime/src/providers/deepseek/index.test.ts b/packages/model-runtime/src/providers/deepseek/index.test.ts
index 431aebc487a..267e2db40b3 100644
--- a/packages/model-runtime/src/providers/deepseek/index.test.ts
+++ b/packages/model-runtime/src/providers/deepseek/index.test.ts
@@ -259,6 +259,37 @@ describe('LobeDeepSeekAI - custom features', () => {
});
});
+ it('should remove reasoning_effort when thinking.type is disabled', () => {
+ const payload = {
+ messages: [{ role: 'user', content: 'hi' }],
+ model: 'deepseek-v4-flash',
+ reasoning_effort: 'high',
+ thinking: { type: 'disabled' },
+ };
+
+ const result = params.chatCompletion!.handlePayload!(payload as any);
+
+ expect(result).toEqual({
+ messages: [{ role: 'user', content: 'hi' }],
+ model: 'deepseek-v4-flash',
+ stream: true,
+ thinking: { type: 'disabled' },
+ });
+ });
+
+ it('should preserve reasoning_effort when thinking is enabled', () => {
+ const payload = {
+ messages: [{ role: 'user', content: 'hi' }],
+ model: 'deepseek-v4-flash',
+ reasoning_effort: 'high',
+ thinking: { type: 'enabled' },
+ };
+
+ const result = params.chatCompletion!.handlePayload!(payload as any);
+
+ expect(result.reasoning_effort).toBe('high');
+ });
+
it('should preserve existing reasoning_content on v4 assistant messages', () => {
const payload = {
messages: [
diff --git a/packages/model-runtime/src/providers/deepseek/index.ts b/packages/model-runtime/src/providers/deepseek/index.ts
index 2223860ca23..fbecf4d85f4 100644
--- a/packages/model-runtime/src/providers/deepseek/index.ts
+++ b/packages/model-runtime/src/providers/deepseek/index.ts
@@ -53,9 +53,13 @@ export const params = {
return rest;
});
+ // DeepSeek rejects `reasoning_effort` when thinking is explicitly disabled.
+ const { reasoning_effort, ...restPayload } = payload;
+
return {
- ...payload,
+ ...restPayload,
messages,
+ ...(!thinkingExplicitlyDisabled && reasoning_effort && { reasoning_effort }),
stream: payload.stream ?? true,
} as any;
},