Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): add DeepSeek as its own provider

Elian Dorancc6afc57c151
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index bd861dff1d..63a456d081 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -3165,6 +3165,7 @@
"provider_desc_claude_agent": "Requires Claude Code on the machine running Trilium.",
"provider_desc_openai": "GPT models via the OpenAI API.",
"provider_desc_google": "Gemini models via the Google API.",
+ "provider_desc_deepseek": "DeepSeek models via the DeepSeek API.",
"actions": "Actions",
"delete_provider": "Delete",
"delete_provider_confirmation": "Are you sure you want to delete the provider \"{{name}}\"?",
diff --git a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.spec.ts b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.spec.ts
index fe31861c5d..d56687be6a 100644
--- a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.spec.ts
+++ b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.spec.ts
@@ -38,7 +38,7 @@ describe("AddProviderModal provider cards", () => {
// section, which exists because that card also reaches *hosted* services
// (OpenRouter, Groq) and so can claim neither free use nor locality.
expect(PROVIDER_TYPES.filter(p => p.group === "cloud").map(p => p.id))
- .toEqual(["anthropic", "openai", "google"]);
+ .toEqual(["anthropic", "openai", "google", "deepseek"]);
expect(PROVIDER_TYPES.filter(p => p.group === "subscription").map(p => p.id))
.toEqual(["claude-agent"]);
expect(PROVIDER_TYPES.filter(p => p.group === "local").map(p => p.id))
@@ -62,7 +62,7 @@ describe("AddProviderModal provider cards", () => {
});
it("keeps vendor cards on a required key and an advanced endpoint override", () => {
- for (const id of ["anthropic", "openai", "google"]) {
+ for (const id of ["anthropic", "openai", "google", "deepseek"]) {
const card = PROVIDER_TYPES.find(p => p.id === id);
// Both default, so neither is set explicitly.
expect(card?.apiKey ?? "required").toBe("required");
diff --git a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx
index dd813f044f..9ab940225e 100644
--- a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx
+++ b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx
@@ -15,6 +15,7 @@ import WizardModal, { type WizardStep } from "../../../react/WizardModal";
import OptionsRow from "../components/OptionsRow";
import anthropicIcon from "./icons/anthropic.svg?url";
import claudeAgentIcon from "./icons/claude-ai.svg?url";
+import deepseekIcon from "./icons/deepseek.svg?url";
import geminiIcon from "./icons/gemini.svg?url";
import lmStudioIcon from "./icons/lmstudio.svg?url";
import ollamaIcon from "./icons/ollama.svg?url";
@@ -91,6 +92,10 @@ export const PROVIDER_TYPES: ProviderType[] = [
{ id: "anthropic", name: "Anthropic", group: "cloud", defaultBaseUrl: "https://api.anthropic.com/v1", iconUrl: anthropicIcon, description: t("llm.provider_desc_anthropic") },
{ id: "openai", name: "OpenAI", group: "cloud", defaultBaseUrl: "https://api.openai.com/v1", iconUrl: openaiIcon, description: t("llm.provider_desc_openai") },
{ id: "google", name: "Google Gemini", group: "cloud", defaultBaseUrl: "https://generativelanguage.googleapis.com/v1beta", iconUrl: geminiIcon, description: t("llm.provider_desc_google") },
+ // Reachable through the custom endpoint card too — it speaks the OpenAI API —
+ // but carded here so its models resolve against the committed price table,
+ // which a nameless endpoint never can.
+ { id: "deepseek", name: "DeepSeek", group: "cloud", defaultBaseUrl: "https://api.deepseek.com/v1", iconUrl: deepseekIcon, description: t("llm.provider_desc_deepseek") },
// Uses the Claude Agent SDK on the server; auth belongs to Claude Code (`claude /login`),
// and usage is covered by the subscription rather than charged per token.
{ id: "claude-agent", name: "Claude Code", group: "subscription", defaultBaseUrl: "", iconUrl: claudeAgentIcon, description: t("llm.provider_desc_claude_agent"), beta: true, apiKey: "none", baseUrl: "none" },
diff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/deepseek.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/deepseek.svg
new file mode 100644
index 0000000000..dc224e43a4
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/llm/icons/deepseek.svg
@@ -0,0 +1 @@
+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"></path></svg>
\ No newline at end of file
diff --git a/apps/server/scripts/update-model-prices.ts b/apps/server/scripts/update-model-prices.ts
index cabdcd02ff..c61873709a 100644
--- a/apps/server/scripts/update-model-prices.ts
+++ b/apps/server/scripts/update-model-prices.ts
@@ -47,14 +47,21 @@ function classify(key: string, provider: string | undefined): string | null {
if (/^gemini-/.test(key)) {
return "google"; // provider tag is unreliable here; key shape is not
}
+ if (/^deepseek-/.test(key) && provider === "deepseek") {
+ return "deepseek";
+ }
return null;
}
/** LiteLLM stores costs per token; we display per million tokens. */
const PER_MILLION = 1_000_000;
-/** At least this many models per provider, or the upstream file is assumed broken. */
-const SANITY_FLOOR: Record<string, number> = { anthropic: 5, openai: 10, google: 5 };
+/**
+ * At least this many models per provider, or the upstream file is assumed broken.
+ * DeepSeek's floor is low because its catalog genuinely is — a handful of rolling
+ * aliases rather than a wall of dated snapshots.
+ */
+const SANITY_FLOOR: Record<string, number> = { anthropic: 5, openai: 10, google: 5, deepseek: 2 };
interface LiteLlmEntry {
litellm_provider?: string;
diff --git a/apps/server/src/services/llm/index.ts b/apps/server/src/services/llm/index.ts
index af2e95e4f6..13ce5ddb98 100644
--- a/apps/server/src/services/llm/index.ts
+++ b/apps/server/src/services/llm/index.ts
@@ -2,6 +2,7 @@ import { getLog, options as optionService } from "@triliumnext/core";
import { AnthropicProvider } from "./providers/anthropic.js";
import { ClaudeAgentProvider } from "./providers/claude_agent.js";
+import { DeepSeekProvider } from "./providers/deepseek.js";
import { GoogleProvider } from "./providers/google.js";
import { LocalProvider } from "./providers/local.js";
import { OpenAiProvider } from "./providers/openai.js";
@@ -27,7 +28,7 @@ export interface LlmProviderSetup {
}
/** Provider type identifiers that can be instantiated, for error messages. */
-const PROVIDER_TYPES = ["anthropic", "openai", "google", "claude-agent", "ollama", "lmstudio", "openai-compatible"];
+const PROVIDER_TYPES = ["anthropic", "openai", "google", "deepseek", "claude-agent", "ollama", "lmstudio", "openai-compatible"];
/**
* Instantiate a provider from its type identifier.
@@ -47,6 +48,10 @@ function createProviderInstance(provider: string, apiKey: string, baseURL?: stri
return new OpenAiProvider(apiKey, baseURL);
case "google":
return new GoogleProvider(apiKey, baseURL);
+ // OpenAI-compatible on the wire, but carded separately from the generic
+ // custom endpoint so its models resolve against the committed price table.
+ case "deepseek":
+ return new DeepSeekProvider(apiKey, baseURL);
// Claude Pro/Max subscription via the Claude Agent SDK — no API key;
// authentication is handled by Claude Code itself (`claude /login`).
case "claude-agent":
diff --git a/apps/server/src/services/llm/providers/deepseek.spec.ts b/apps/server/src/services/llm/providers/deepseek.spec.ts
new file mode 100644
index 0000000000..39e34e012c
--- /dev/null
+++ b/apps/server/src/services/llm/providers/deepseek.spec.ts
@@ -0,0 +1,139 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const createOpenAiMock = vi.fn();
+const chatMock = vi.fn(() => ({}));
+
+vi.mock("@ai-sdk/openai", () => ({
+ createOpenAI: (opts: unknown) => {
+ createOpenAiMock(opts);
+ const fn: any = () => ({});
+ fn.chat = chatMock;
+ return fn;
+ }
+}));
+
+import { DeepSeekProvider, deepSeekModelName } from "./deepseek.js";
+
+describe("DeepSeekProvider construction", () => {
+ beforeEach(() => {
+ createOpenAiMock.mockClear();
+ chatMock.mockClear();
+ });
+
+ it("points at the official endpoint unless overridden, and requires a key", () => {
+ new DeepSeekProvider("sk-deep");
+ expect(createOpenAiMock).toHaveBeenCalledWith({ apiKey: "sk-deep", baseURL: "https://api.deepseek.com/v1" });
+
+ // An override reaches a gateway in front of DeepSeek; a blank one is no override.
+ new DeepSeekProvider("sk-deep", "https://gateway.example/v1");
+ expect(createOpenAiMock).toHaveBeenLastCalledWith({ apiKey: "sk-deep", baseURL: "https://gateway.example/v1" });
+ new DeepSeekProvider("sk-deep", "");
+ expect(createOpenAiMock).toHaveBeenLastCalledWith({ apiKey: "sk-deep", baseURL: "https://api.deepseek.com/v1" });
+
+ expect(() => new DeepSeekProvider("")).toThrow(/API key is required/);
+ });
+
+ it("builds models through Chat Completions, which is all DeepSeek implements", () => {
+ const provider = new DeepSeekProvider("sk-deep") as any;
+ provider.createModel("deepseek-chat");
+ // `.chat()`, not the callable default — that would be the Responses API.
+ expect(chatMock).toHaveBeenCalledWith("deepseek-chat");
+ });
+});
+
+describe("DeepSeekProvider model listing", () => {
+ const fetchMock = vi.fn();
+ const okJson = (body: unknown) => ({ ok: true, json: async () => body });
+
+ beforeEach(() => {
+ fetchMock.mockReset();
+ vi.stubGlobal("fetch", fetchMock);
+ });
+
+ it("lists /models with a bearer key and prices the ids against the committed table", async () => {
+ fetchMock.mockResolvedValue(okJson({ data: [{ id: "deepseek-chat" }, { id: "deepseek-reasoner" }] }));
+ const provider = new DeepSeekProvider("sk-deep");
+
+ const models = await provider.listModels();
+ expect(fetchMock).toHaveBeenCalledWith(
+ "https://api.deepseek.com/v1/models",
+ expect.objectContaining({ headers: { Authorization: "Bearer sk-deep" } })
+ );
+ expect(models.map(m => m.id)).toEqual(["deepseek-chat", "deepseek-reasoner"]);
+ // The whole point of carding DeepSeek rather than leaving it to the generic
+ // endpoint: its bare ids join against model_prices.json, so cost and context
+ // resolve. Values live in the committed table, so only assert they are there.
+ expect(models[0].pricing).toBeDefined();
+ expect(models[0].contextWindow).toBeGreaterThan(0);
+ // Both cost the same, so the tie goes to the first listed — chat, not the
+ // reasoner, which spends far more tokens for the same price per token.
+ expect(models[0]).toMatchObject({ isDefault: true, name: "DeepSeek Chat" });
+ });
+
+ it("repoints the defaults at the ids the account actually lists", async () => {
+ // A v4-era account lists neither `deepseek-chat` nor `deepseek-reasoner`,
+ // so the hardcoded fallbacks must not survive a successful listing —
+ // generating a title with an unlisted model is a request that just fails.
+ fetchMock.mockResolvedValue(okJson({ data: [{ id: "deepseek-v4-pro" }, { id: "deepseek-v4-flash" }] }));
+ const provider = new DeepSeekProvider("sk-deep") as any;
+
+ const models = await provider.listModels();
+ // Cheapest for titles, flagship for conversation.
+ expect(provider.titleModel).toBe("deepseek-v4-flash");
+ expect(provider.defaultModel).toBe("deepseek-v4-pro");
+ expect(models.find((m: any) => m.isDefault)?.id).toBe("deepseek-v4-pro");
+ });
+
+ it("keeps the alias when a listing never happens, and never titles with an unpriced id", async () => {
+ // Offline: the fallback alias is all there is, and generateTitle must not
+ // throw on the listing it attempts first.
+ fetchMock.mockRejectedValue(new Error("offline"));
+ const offline = new DeepSeekProvider("sk-deep") as any;
+ await expect(offline.listModels()).rejects.toThrow("offline");
+ expect(offline.titleModel).toBe("deepseek-chat");
+
+ // A gateway serving ids the price table doesn't know: unpriced ids sort
+ // last, so a priced one is still preferred for titles.
+ fetchMock.mockResolvedValue(okJson({ data: [{ id: "some-proxy-model" }, { id: "deepseek-v4-flash" }] }));
+ const proxied = new DeepSeekProvider("sk-deep") as any;
+ await proxied.listModels();
+ expect(proxied.titleModel).toBe("deepseek-v4-flash");
+ });
+
+ it("honours a base URL override and surfaces listing failures", async () => {
+ fetchMock.mockResolvedValue(okJson({ data: [{ id: "deepseek-chat" }] }));
+ await new DeepSeekProvider("sk-deep", "https://gateway.example/v1").listModels();
+ expect(fetchMock).toHaveBeenCalledWith("https://gateway.example/v1/models", expect.anything());
+
+ fetchMock.mockRejectedValue(new Error("offline"));
+ await expect(new DeepSeekProvider("sk-deep").listModels()).rejects.toThrow("offline");
+
+ fetchMock.mockResolvedValue(okJson({ data: { unexpected: "shape" } }));
+ await expect(new DeepSeekProvider("sk-deep").listModels()).rejects.toThrow(/Unexpected \/models response shape/);
+ });
+});
+
+describe("DeepSeekProvider recommendations", () => {
+ it("pre-selects the current line but not the superseded coder models", () => {
+ const provider = new DeepSeekProvider("sk-deep");
+ const recommended = provider.recommendedModelIds([
+ { id: "deepseek-chat", name: "DeepSeek Chat" },
+ { id: "deepseek-reasoner", name: "DeepSeek Reasoner" },
+ { id: "deepseek-coder", name: "DeepSeek Coder" },
+ { id: "deepseek-chat-preview", name: "DeepSeek Chat Preview" },
+ { id: "deepseek-old", name: "DeepSeek Old", isLegacy: true }
+ ]);
+ expect([...recommended]).toEqual(["deepseek-chat", "deepseek-reasoner"]);
+ });
+});
+
+describe("deepSeekModelName", () => {
+ it("titles the DeepSeek line and leaves foreign ids alone", () => {
+ expect(deepSeekModelName("deepseek-chat")).toBe("DeepSeek Chat");
+ expect(deepSeekModelName("deepseek-reasoner")).toBe("DeepSeek Reasoner");
+ // Version segments stay upper-case rather than becoming "V4" → "V4" vs "v4".
+ expect(deepSeekModelName("deepseek-v4-pro")).toBe("DeepSeek V4 Pro");
+ // A gateway serving something else keeps its id verbatim.
+ expect(deepSeekModelName("llama3.2")).toBe("llama3.2");
+ });
+});
diff --git a/apps/server/src/services/llm/providers/deepseek.ts b/apps/server/src/services/llm/providers/deepseek.ts
new file mode 100644
index 0000000000..ec42ff9928
--- /dev/null
+++ b/apps/server/src/services/llm/providers/deepseek.ts
@@ -0,0 +1,142 @@
+import { createOpenAI, type OpenAIProvider as OpenAISDKProvider } from "@ai-sdk/openai";
+
+import type { ModelInfo } from "../types.js";
+import { BaseProvider, type RemoteModel } from "./base_provider.js";
+
+/**
+ * DeepSeek's OpenAI-compatible endpoint. The `/v1` here is the compatibility
+ * path their SDK guide uses and has nothing to do with the model version — the
+ * bare host answers identically.
+ */
+const OFFICIAL_BASE_URL = "https://api.deepseek.com/v1";
+
+/**
+ * DeepSeek, over its OpenAI-compatible API. It could be reached through the
+ * generic custom-endpoint card, but a card of its own is what makes its models
+ * priced: {@link BaseProvider.getProviderPrices} keys the committed table by
+ * provider name, and DeepSeek publishes bare ids (`deepseek-chat`) that the
+ * table carries verbatim — so cost and context windows resolve, which they never
+ * can for an endpoint we can't name.
+ */
+export class DeepSeekProvider extends BaseProvider {
+ name = "deepseek";
+ /**
+ * Only the pre-listing fallback. DeepSeek retires ids between generations —
+ * an account provisioned for the v4 line lists neither of these — so the real
+ * defaults come from {@link pickModelDefaults} once the endpoint has answered.
+ */
+ protected defaultModel = "deepseek-chat";
+ protected titleModel = "deepseek-chat";
+
+ /** Whether the two above have been replaced by ids the endpoint actually offers. */
+ private defaultsFromListing = false;
+
+ private openai: OpenAISDKProvider;
+
+ constructor(apiKey: string, baseURL?: string) {
+ super(apiKey, baseURL);
+ if (!apiKey) {
+ throw new Error("API key is required for DeepSeek provider");
+ }
+ this.openai = createOpenAI({ apiKey, baseURL: this.baseURL ?? OFFICIAL_BASE_URL });
+ }
+
+ /**
+ * Chat Completions rather than the Responses API, which DeepSeek doesn't
+ * implement — the same reason the self-hosted provider pins `.chat()`.
+ */
+ protected createModel(modelId: string) {
+ return this.openai.chat(modelId);
+ }
+
+ /** Everything DeepSeek lists is a chat model, so nothing is filtered out. */
+ protected override async fetchRemoteModels(): Promise<RemoteModel[] | null> {
+ const payload = await this.fetchJson(`${this.baseURL ?? OFFICIAL_BASE_URL}/models`, {
+ Authorization: `Bearer ${this.apiKey}`
+ });
+ const data = (payload as { data?: unknown }).data;
+ if (!Array.isArray(data)) {
+ throw new Error("Unexpected /models response shape");
+ }
+ const models = data
+ .filter((m): m is { id: string } => typeof (m as { id?: unknown }).id === "string")
+ .map(m => ({ id: m.id, name: deepSeekModelName(m.id) }));
+ this.pickModelDefaults(models.map(m => m.id));
+ return models;
+ }
+
+ /**
+ * Point the defaults at ids the account actually has. Titles go to the
+ * cheapest listed model — a title is one line, generated for every new chat —
+ * and conversation to the dearest, which is DeepSeek's flagship tier.
+ *
+ * Both take the *first* of a tied group rather than the last, so a chat and a
+ * reasoner priced identically default to chat: same cost per token, but the
+ * reasoner spends far more of them thinking.
+ */
+ private pickModelDefaults(ids: string[]): void {
+ if (ids.length === 0) {
+ return;
+ }
+ const prices = this.getProviderPrices();
+ // Ids the table doesn't know (a gateway serving something else) can't be
+ // ranked on cost, so they decide nothing unless nothing at all is priced.
+ const priced = ids.filter(id => prices[id]);
+ const ranked = priced.length > 0 ? priced : ids;
+ const cost = (id: string) => prices[id]?.output ?? 0;
+ const costs = ranked.map(cost);
+ const cheapest = Math.min(...costs);
+ const dearest = Math.max(...costs);
+
+ this.titleModel = ranked.find(id => cost(id) === cheapest) ?? ids[0];
+ this.defaultModel = ranked.find(id => cost(id) === dearest) ?? ids[0];
+ this.defaultsFromListing = true;
+ }
+
+ /**
+ * The title model is only known once the endpoint has been listed, so make
+ * sure that has happened. The base class caches the list, so this is a no-op
+ * after the first call; a listing failure falls through to the alias above
+ * rather than costing the user a title.
+ */
+ override async generateTitle(firstMessage: string): Promise<string> {
+ if (!this.defaultsFromListing) {
+ await this.listModels().catch(() => undefined);
+ }
+ return super.generateTitle(firstMessage);
+ }
+
+ protected override modelName(id: string): string {
+ return deepSeekModelName(id);
+ }
+
+ /**
+ * The catalog is small enough to recommend wholesale, minus the coder line —
+ * `deepseek-coder` was folded into `deepseek-chat` and lingers only for
+ * callers pinned to it, so pre-selecting it would put a superseded model in
+ * front of the user.
+ */
+ override recommendedModelIds(models: ModelInfo[]): Set<string> {
+ return new Set(
+ models
+ .filter(m => !m.isLegacy && !/preview/i.test(m.id) && !/^deepseek-coder/.test(m.id))
+ .map(m => m.id)
+ );
+ }
+}
+
+/**
+ * `deepseek-chat` → "DeepSeek Chat", `deepseek-v4-pro` → "DeepSeek V4 Pro". The
+ * `/models` response carries ids only, and an unprefixed id (a proxy serving
+ * something else) is left exactly as it came.
+ */
+export function deepSeekModelName(id: string): string {
+ const match = /^deepseek-(.+)$/.exec(id);
+ if (!match) {
+ return id;
+ }
+ const words = match[1]
+ .split("-")
+ .map(word => (/^v\d+$/i.test(word) ? word.toUpperCase() : word.charAt(0).toUpperCase() + word.slice(1)));
+ return `DeepSeek ${words.join(" ")}`;
+}
diff --git a/apps/server/src/services/llm/providers/model_prices.json b/apps/server/src/services/llm/providers/model_prices.json
index 1707f9b0e2..c3244e9a8f 100644
--- a/apps/server/src/services/llm/providers/model_prices.json
+++ b/apps/server/src/services/llm/providers/model_prices.json
@@ -116,6 +116,28 @@
"ctx": 1000000
}
},
+ "deepseek": {
+ "deepseek-chat": {
+ "input": 0.28,
+ "output": 0.42,
+ "ctx": 131072
+ },
+ "deepseek-reasoner": {
+ "input": 0.28,
+ "output": 0.42,
+ "ctx": 131072
+ },
+ "deepseek-v4-flash": {
+ "input": 0.14,
+ "output": 0.28,
+ "ctx": 1000000
+ },
+ "deepseek-v4-pro": {
+ "input": 0.435,
+ "output": 0.87,
+ "ctx": 1000000
+ }
+ },
"google": {
"gemini-2.0-flash": {
"input": 0.1,