Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): group legacy models into submenu

Elian Dorane4c4873aa7bf
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 20a9ae46ae..84bc0dbed5 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1621,6 +1621,7 @@
"note_tools": "Note access",
"sources": "Sources",
"extended_thinking": "Extended thinking",
+ "legacy_models": "Legacy models",
"thinking": "Thinking...",
"thought_process": "Thought process",
"tool_calls": "{{count}} tool call(s)",
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
index 54a15105f1..27ef327b43 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
@@ -2,7 +2,7 @@ import type { RefObject } from "preact";
import { t } from "../../../services/i18n.js";
import Dropdown from "../../react/Dropdown.js";
-import { FormListItem } from "../../react/FormList.js";
+import { FormDropdownDivider, FormDropdownSubmenu, FormListItem } from "../../react/FormList.js";
import type { UseLlmChatReturn } from "./useLlmChat.js";
/** Format token count with thousands separators */
@@ -60,6 +60,8 @@ export default function ChatInputBar({
};
const currentModel = chat.availableModels.find(m => m.id === chat.selectedModel);
+ const currentModels = chat.availableModels.filter(m => !m.isLegacy);
+ const legacyModels = chat.availableModels.filter(m => m.isLegacy);
const contextWindow = currentModel?.contextWindow || 200000;
const percentage = Math.min((chat.lastPromptTokens / contextWindow) * 100, 100);
const isWarning = percentage > 75;
@@ -95,15 +97,34 @@ export default function ChatInputBar({
disabled={chat.isStreaming}
buttonClassName="llm-chat-model-select"
>
- {chat.availableModels.map(model => (
+ {currentModels.map(model => (
<FormListItem
key={model.id}
onClick={() => handleModelSelect(model.id)}
checked={chat.selectedModel === model.id}
>
- {model.name}<small>({model.costDescription})</small>
+ {model.name} <small>({model.costDescription})</small>
</FormListItem>
))}
+ {legacyModels.length > 0 && (
+ <>
+ <FormDropdownDivider />
+ <FormDropdownSubmenu
+ icon="bx bx-history"
+ title={t("llm_chat.legacy_models")}
+ >
+ {legacyModels.map(model => (
+ <FormListItem
+ key={model.id}
+ onClick={() => handleModelSelect(model.id)}
+ checked={chat.selectedModel === model.id}
+ >
+ {model.name} <small>({model.costDescription})</small>
+ </FormListItem>
+ ))}
+ </FormDropdownSubmenu>
+ </>
+ )}
</Dropdown>
</div>
<label className="llm-chat-toggle">
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
index 1cf23f104c..901c9e6adc 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
@@ -325,6 +325,12 @@
margin-left: 0.5em;
color: var(--muted-text-color);
}
+
+ /* Position legacy models submenu to open upward */
+ .dropdown-submenu .dropdown-menu {
+ bottom: 0;
+ top: auto;
+ }
}
.llm-chat-model-select.select-button {
diff --git a/apps/server/src/services/llm/providers/anthropic.ts b/apps/server/src/services/llm/providers/anthropic.ts
index 68ca353b99..00a8caf2f4 100644
--- a/apps/server/src/services/llm/providers/anthropic.ts
+++ b/apps/server/src/services/llm/providers/anthropic.ts
@@ -46,31 +46,36 @@ const BASE_MODELS: Omit<ModelInfo, "costMultiplier">[] = [
id: "claude-sonnet-4-5-20250929",
name: "Claude Sonnet 4.5",
pricing: { input: 3, output: 15 },
- contextWindow: 200000 // 1M available with beta header
+ contextWindow: 200000, // 1M available with beta header
+ isLegacy: true
},
{
id: "claude-opus-4-5-20251101",
name: "Claude Opus 4.5",
pricing: { input: 5, output: 25 },
- contextWindow: 200000
+ contextWindow: 200000,
+ isLegacy: true
},
{
id: "claude-opus-4-1-20250805",
name: "Claude Opus 4.1",
pricing: { input: 15, output: 75 },
- contextWindow: 200000
+ contextWindow: 200000,
+ isLegacy: true
},
{
id: "claude-sonnet-4-20250514",
name: "Claude Sonnet 4.0",
pricing: { input: 3, output: 15 },
- contextWindow: 200000 // 1M available with beta header
+ contextWindow: 200000, // 1M available with beta header
+ isLegacy: true
},
{
id: "claude-opus-4-20250514",
name: "Claude Opus 4.0",
pricing: { input: 15, output: 75 },
- contextWindow: 200000
+ contextWindow: 200000,
+ isLegacy: true
}
];
diff --git a/packages/commons/src/lib/llm_api.ts b/packages/commons/src/lib/llm_api.ts
index 01523c2ec3..9c05f9f0f3 100644
--- a/packages/commons/src/lib/llm_api.ts
+++ b/packages/commons/src/lib/llm_api.ts
@@ -63,6 +63,8 @@ export interface LlmModelInfo {
pricing: LlmModelPricing;
/** Whether this is the default model */
isDefault?: boolean;
+ /** Whether this is a legacy/older model */
+ isLegacy?: boolean;
/** Cost multiplier relative to the cheapest model (1x = cheapest) */
costMultiplier?: number;
/** Maximum context window size in tokens */