Skip to content

Commit 5e8fcc8

Browse files
authored
[Feat] Add deepseek-v4-flash-vision-exp to Deepseek AI (#1438)
* update model config * add test unit * update test * trigger ci re-run
1 parent a1ca0c8 commit 5e8fcc8

4 files changed

Lines changed: 105 additions & 1 deletion

File tree

‎packages/types/src/__tests__/deepseek-v4-pro.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ describe("DeepSeek V4 Pro 0813 provider catalogs", () => {
3535
})
3636
})
3737

38+
it("marks deepseek-v4-flash-vision-exp as a vision-capable model", () => {
39+
const model = deepSeekModels["deepseek-v4-flash-vision-exp"]
40+
expect(model).toBeDefined()
41+
expect(model.supportsImages).toBe(true)
42+
expect(model.supportsPromptCache).toBe(true)
43+
expect(model.contextWindow).toBeGreaterThanOrEqual(1_000_000)
44+
expect(model.supportsReasoningEffort).toEqual(["disable", "low", "high", "max"])
45+
})
46+
3847
// Self-hosted providers retain separate IDs for the preview weights and 0813 checkpoint.
3948
it.each([
4049
["Fireworks AI", fireworksModels["accounts/fireworks/models/deepseek-v4-pro"]],

‎packages/types/src/providers/deepseek.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ export const deepSeekModels = {
4040
cacheReadsPrice: 0.044,
4141
description: `DeepSeek-V4-Pro-0813 is DeepSeek's strongest V4 model for reasoning, coding, long-context, and agentic workloads. It supports thinking and non-thinking modes, JSON output, tool calls, chat prefix completion (beta), and FIM completion (beta) in non-thinking mode.`,
4242
},
43+
"deepseek-v4-flash-vision-exp": {
44+
displayName: "DeepSeek V4 Flash Vision Exp",
45+
maxTokens: 384_000,
46+
contextWindow: 1_000_000,
47+
supportsImages: true,
48+
supportsPromptCache: true,
49+
supportsReasoningEffort: ["disable", "low", "high", "max"], // Updated 2026-08-13
50+
preserveReasoning: true,
51+
reasoningEffort: "high",
52+
inputPrice: 0, // the inputs are priced as cache read/write, so `inputPrice` should be 0
53+
// Static estimates use peak rates; off-peak rates are 50% lower.
54+
outputPrice: 1.32,
55+
cacheWritesPrice: 0.44,
56+
cacheReadsPrice: 0.014,
57+
description: `DeepSeek-V4-Flash-Vision-Exp is DeepSeek's experimental multimodal V4 Flash model with image understanding. It supports thinking and non-thinking modes, JSON output, tool calls, chat prefix completion (beta), and image inputs.`,
58+
},
4359
} as const satisfies Record<string, ModelInfo>
4460

4561
// https://api-docs.deepseek.com/quick_start/parameter_settings

‎src/api/providers/__tests__/deepseek.spec.ts‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ describe("DeepSeekHandler", () => {
249249
expect((model.info as ModelInfo).reasoningEffort).toBe("high")
250250
})
251251

252+
it("should return vision model info for deepseek-v4-flash-vision-exp", () => {
253+
const handlerWithVision = new DeepSeekHandler({
254+
...mockOptions,
255+
apiModelId: "deepseek-v4-flash-vision-exp",
256+
})
257+
const model = handlerWithVision.getModel()
258+
expect(model.id).toBe("deepseek-v4-flash-vision-exp")
259+
expect(model.info.supportsImages).toBe(true)
260+
expect(model.info.supportsPromptCache).toBe(true)
261+
expect((model.info as ModelInfo).preserveReasoning).toBe(true)
262+
})
263+
252264
it("should return provided model ID with default model info if model does not exist", () => {
253265
const handlerWithInvalidModel = new DeepSeekHandler({
254266
...mockOptions,
@@ -412,6 +424,42 @@ describe("DeepSeekHandler", () => {
412424
const reasoningChunks = chunks.filter((chunk) => chunk.type === "reasoning")
413425
expect(reasoningChunks).toEqual([{ type: "reasoning", text: "primary thought" }])
414426
})
427+
428+
it("enables thinking and forwards image_url for the vision model", async () => {
429+
const visionHandler = new DeepSeekHandler({
430+
...mockOptions,
431+
apiModelId: "deepseek-v4-flash-vision-exp",
432+
})
433+
const withImage: Anthropic.Messages.MessageParam[] = [
434+
{
435+
role: "user",
436+
content: [
437+
{ type: "text", text: "Describe:" },
438+
{ type: "image", source: { type: "base64", media_type: "image/png", data: "abc" } },
439+
],
440+
},
441+
]
442+
443+
await collectStream(visionHandler.createMessage(systemPrompt, withImage))
444+
445+
const callArgs = mockCreate.mock.calls[0][0]
446+
expect(callArgs.thinking).toEqual({ type: "enabled" })
447+
expect(callArgs.messages).toEqual(
448+
expect.arrayContaining([
449+
expect.objectContaining({
450+
role: "user",
451+
content: expect.arrayContaining([
452+
expect.objectContaining({
453+
type: "image_url",
454+
image_url: expect.objectContaining({
455+
url: "data:image/png;base64,abc",
456+
}),
457+
}),
458+
]),
459+
}),
460+
]),
461+
)
462+
})
415463
})
416464

417465
describe("processUsageMetrics", () => {
@@ -684,6 +732,36 @@ describe("DeepSeekHandler", () => {
684732
rawReasoningEffort: "max",
685733
mappedReasoningEffort: "max",
686734
},
735+
{
736+
modelId: "deepseek-v4-flash-vision-exp",
737+
rawReasoningEffort: "disable",
738+
mappedReasoningEffort: undefined,
739+
},
740+
{
741+
modelId: "deepseek-v4-flash-vision-exp",
742+
rawReasoningEffort: "low",
743+
mappedReasoningEffort: "low",
744+
},
745+
{
746+
modelId: "deepseek-v4-flash-vision-exp",
747+
rawReasoningEffort: "medium",
748+
mappedReasoningEffort: "high",
749+
},
750+
{
751+
modelId: "deepseek-v4-flash-vision-exp",
752+
rawReasoningEffort: "high",
753+
mappedReasoningEffort: "high",
754+
},
755+
{
756+
modelId: "deepseek-v4-flash-vision-exp",
757+
rawReasoningEffort: "xhigh",
758+
mappedReasoningEffort: "high",
759+
},
760+
{
761+
modelId: "deepseek-v4-flash-vision-exp",
762+
rawReasoningEffort: "max",
763+
mappedReasoningEffort: "max",
764+
},
687765
]
688766

689767
for (const { modelId, rawReasoningEffort, mappedReasoningEffort } of mappings) {

‎src/api/providers/deepseek.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type DeepSeekChatCompletionParams = Omit<OpenAI.Chat.ChatCompletionCreateParamsS
2828
reasoning_effort?: "low" | "high" | "max"
2929
}
3030

31-
const deepSeekV4ThinkingModels = new Set(["deepseek-v4-flash", "deepseek-v4-pro"])
31+
const deepSeekV4ThinkingModels = new Set(["deepseek-v4-flash", "deepseek-v4-pro", "deepseek-v4-flash-vision-exp"])
3232
const supportsDeepSeekThinkingToggle = (modelId: string) => deepSeekV4ThinkingModels.has(modelId)
3333

3434
// Only known V4 models and the legacy reasoner alias support DeepSeek's
@@ -51,6 +51,7 @@ export const normalizeDeepSeekReasoningEffort = (
5151
switch (modelId) {
5252
case "deepseek-v4-flash":
5353
case "deepseek-v4-pro":
54+
case "deepseek-v4-flash-vision-exp":
5455
switch (reasoningEffort) {
5556
case "low":
5657
return "low"

0 commit comments

Comments
 (0)