Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(llm): show subscription models with a clean name and cost label
Elian Dorane5b80973184b
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex d4a60ad8c9..77be875944 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -2116,6 +2116,7 @@"sources_summary": "{{count}} sources from {{sites}} sites","extended_thinking": "Extended thinking","legacy_models": "Legacy models",+ "model_cost_included": "Subscription","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.tsxindex 9bf0a9bfd8..602122df4b 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx@@ -342,7 +342,7 @@ export default function ChatInputBar({onClick={() => handleModelSelect(model.id)}checked={chat.selectedModel === model.id}>- {model.name} <small>({model.costDescription})</small>+ {model.name}{model.costDescription && <> <small>({model.costDescription})</small></>}</FormListItem>))}{legacyModels.length > 0 && (@@ -358,7 +358,7 @@ export default function ChatInputBar({onClick={() => handleModelSelect(model.id)}checked={chat.selectedModel === model.id}>- {model.name} <small>({model.costDescription})</small>+ {model.name}{model.costDescription && <> <small>({model.costDescription})</small></>}</FormListItem>))}</FormDropdownSubmenu>diff --git a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.tsindex f746504d7d..7d310f0eaf 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts+++ b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts@@ -2,6 +2,7 @@ import type { LlmCitation, LlmMessage, LlmMessagePart, LlmModelInfo, LlmUsage }import { RefObject } from "preact";import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";+import { t } from "../../../services/i18n.js";import { getAvailableModels, streamChatCompletion } from "../../../services/llm_chat.js";import { randomString } from "../../../services/utils.js";import { useTriliumEvent } from "../../react/hooks.js";@@ -268,7 +269,9 @@ export function useLlmChat(getAvailableModels().then(models => {const modelsWithDescription = models.map(m => ({...m,- costDescription: m.costMultiplier ? `${m.costMultiplier}x` : undefined+ costDescription: m.isSubscription+ ? t("llm_chat.model_cost_included")+ : m.costMultiplier ? `${m.costMultiplier}x` : undefined}));setAvailableModels(modelsWithDescription);setHasProvider(models.length > 0);diff --git a/apps/server/src/services/llm/providers/claude_agent.ts b/apps/server/src/services/llm/providers/claude_agent.tsindex 278df10741..04b9bb985a 100644--- a/apps/server/src/services/llm/providers/claude_agent.ts+++ b/apps/server/src/services/llm/providers/claude_agent.ts@@ -37,28 +37,32 @@ import { buildSystemPrompt } from "./system_prompt.js";const { models: AVAILABLE_MODELS, pricing: MODEL_PRICING } = buildModelList([{id: "claude-fable-5",- name: "Claude Fable 5 (subscription)",+ name: "Claude Fable 5",pricing: { input: 0, output: 0 },- contextWindow: 1000000+ contextWindow: 1000000,+ isSubscription: true},{id: "claude-sonnet-5",- name: "Claude Sonnet 5 (subscription)",+ name: "Claude Sonnet 5",pricing: { input: 0, output: 0 },contextWindow: 1000000,- isDefault: true+ isDefault: true,+ isSubscription: true},{id: "claude-opus-4-8",- name: "Claude Opus 4.8 (subscription)",+ name: "Claude Opus 4.8",pricing: { input: 0, output: 0 },- contextWindow: 1000000+ contextWindow: 1000000,+ isSubscription: true},{id: "claude-haiku-4-5-20251001",- name: "Claude Haiku 4.5 (subscription)",+ name: "Claude Haiku 4.5",pricing: { input: 0, output: 0 },- contextWindow: 200000+ contextWindow: 200000,+ isSubscription: true}]);diff --git a/apps/server/src/services/llm/types.ts b/apps/server/src/services/llm/types.tsindex f5da030311..451f80ca5b 100644--- a/apps/server/src/services/llm/types.ts+++ b/apps/server/src/services/llm/types.ts@@ -50,6 +50,8 @@ export interface ModelInfo {contextWindow?: number;/** Whether this is a legacy/older model */isLegacy?: boolean;+ /** Whether usage is covered by a subscription plan rather than metered per token */+ isSubscription?: boolean;}export interface LlmProvider {diff --git a/packages/commons/src/lib/llm_api.ts b/packages/commons/src/lib/llm_api.tsindex 8c17eec73e..fd4a1b24b1 100644--- a/packages/commons/src/lib/llm_api.ts+++ b/packages/commons/src/lib/llm_api.ts@@ -124,6 +124,8 @@ export interface LlmModelInfo {costMultiplier?: number;/** Maximum context window size in tokens */contextWindow?: number;+ /** Whether usage is covered by a subscription plan rather than metered per token */+ isSubscription?: boolean;}/**