From 9fe06db9216b895c0c1deb6a0b74515b2de083e6 Mon Sep 17 00:00:00 2001 From: "roomote[bot]" <219738659+roomote[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:03:35 -0700 Subject: [PATCH] fix: update DeepSeek models context window to 128k (#7269) * fix: update DeepSeek models context window to 128k - Updated deepseek-chat and deepseek-reasoner models from 64k to 128k context window - Updated corresponding test expectations - Aligns with DeepSeek API documentation at https://api-docs.deepseek.com/quick_start/pricing/ Fixes #7268 * feat: update deepseek-reasoner maxTokens to 64K based on official documentation * fix: use default maxTokens values instead of maximum for DeepSeek models - deepseek-chat: 4096 (4K default) instead of 8192 (8K max) - deepseek-reasoner: 32768 (32K default) instead of 65536 (64K max) - Updated tests to match new default values - Updated description to clarify default vs max output tokens * fix: use maximum output tokens for both DeepSeek models - deepseek-chat: 8192 (8K max) - deepseek-reasoner: 65536 (64K max) - Updated tests to match maximum values - Updated description to reflect 64K max output --------- Co-authored-by: Roo Code Co-authored-by: daniel-lxs --- packages/types/src/providers/deepseek.ts | 10 +++++----- src/api/providers/__tests__/deepseek.spec.ts | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/types/src/providers/deepseek.ts b/packages/types/src/providers/deepseek.ts index 5ef757ffdf..8ce5ef87b2 100644 --- a/packages/types/src/providers/deepseek.ts +++ b/packages/types/src/providers/deepseek.ts @@ -7,8 +7,8 @@ export const deepSeekDefaultModelId: DeepSeekModelId = "deepseek-chat" export const deepSeekModels = { "deepseek-chat": { - maxTokens: 8192, - contextWindow: 64_000, + maxTokens: 8192, // 8K max output + contextWindow: 128_000, supportsImages: false, supportsPromptCache: true, inputPrice: 0.27, // $0.27 per million tokens (cache miss) @@ -18,15 +18,15 @@ export const deepSeekModels = { description: `DeepSeek-V3 achieves a significant breakthrough in inference speed over previous models. It tops the leaderboard among open-source models and rivals the most advanced closed-source models globally.`, }, "deepseek-reasoner": { - maxTokens: 8192, - contextWindow: 64_000, + maxTokens: 65536, // 64K max output for reasoning mode + contextWindow: 128_000, supportsImages: false, supportsPromptCache: true, inputPrice: 0.55, // $0.55 per million tokens (cache miss) outputPrice: 2.19, // $2.19 per million tokens cacheWritesPrice: 0.55, // $0.55 per million tokens (cache miss) cacheReadsPrice: 0.14, // $0.14 per million tokens (cache hit) - description: `DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks. Supports Chain of Thought reasoning with up to 32K tokens.`, + description: `DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks. Supports Chain of Thought reasoning with up to 64K output tokens.`, }, } as const satisfies Record diff --git a/src/api/providers/__tests__/deepseek.spec.ts b/src/api/providers/__tests__/deepseek.spec.ts index 175a5bc44b..50cabfa922 100644 --- a/src/api/providers/__tests__/deepseek.spec.ts +++ b/src/api/providers/__tests__/deepseek.spec.ts @@ -154,12 +154,26 @@ describe("DeepSeekHandler", () => { const model = handler.getModel() expect(model.id).toBe(mockOptions.apiModelId) expect(model.info).toBeDefined() - expect(model.info.maxTokens).toBe(8192) - expect(model.info.contextWindow).toBe(64_000) + expect(model.info.maxTokens).toBe(8192) // deepseek-chat has 8K max + expect(model.info.contextWindow).toBe(128_000) expect(model.info.supportsImages).toBe(false) expect(model.info.supportsPromptCache).toBe(true) // Should be true now }) + it("should return correct model info for deepseek-reasoner", () => { + const handlerWithReasoner = new DeepSeekHandler({ + ...mockOptions, + apiModelId: "deepseek-reasoner", + }) + const model = handlerWithReasoner.getModel() + expect(model.id).toBe("deepseek-reasoner") + expect(model.info).toBeDefined() + expect(model.info.maxTokens).toBe(65536) // deepseek-reasoner has 64K max + expect(model.info.contextWindow).toBe(128_000) + expect(model.info.supportsImages).toBe(false) + expect(model.info.supportsPromptCache).toBe(true) + }) + it("should return provided model ID with default model info if model does not exist", () => { const handlerWithInvalidModel = new DeepSeekHandler({ ...mockOptions,