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): separate custom endpoints from local ones, and trim the blurbs
Elian Dorandecd24f5ece7
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 4b32c1bde5..9b68c0f1cd 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -3161,10 +3161,10 @@"connection_details": "Connection","advanced_options": "Advanced options","beta": "Beta",- "provider_desc_anthropic": "Claude models via the Anthropic API. Requires an API key.",- "provider_desc_claude_agent": "Claude models via Claude Code, installed on the machine running Trilium.",- "provider_desc_openai": "GPT models via the OpenAI API. Requires an API key.",- "provider_desc_google": "Gemini models via the Google API. Requires an API key.",+ "provider_desc_anthropic": "Claude models via the Anthropic API.",+ "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.","actions": "Actions","delete_provider": "Delete","delete_provider_confirmation": "Are you sure you want to delete the provider \"{{name}}\"?",@@ -3180,15 +3180,17 @@"provider_group_subscription": "Subscription","provider_group_subscription_description": "Reuses a subscription you already pay for, at no extra cost. Your notes are sent to the provider's servers.","provider_group_local": "Local / self-hosted",- "provider_group_local_description": "No usage cost. Your notes only reach the machine running the model.",- "provider_desc_ollama": "Local models via an Ollama instance. No API key needed — just the instance URL.",- "provider_desc_lmstudio": "Local models via LM Studio's built-in server. No API key needed — just the server URL.",+ "provider_group_local_description": "No API key, no usage cost. Your notes only reach the machine running the model.",+ "provider_group_custom": "Custom endpoint",+ "provider_group_custom_description": "Any OpenAI-compatible API, local or hosted (OpenRouter, Groq, DeepSeek, Mistral). Cost and privacy depend on where you point it.",+ "provider_desc_ollama": "Local models via an Ollama instance.",+ "provider_desc_lmstudio": "Local models via LM Studio's built-in server.","provider_openai_compatible": "OpenAI-compatible",- "provider_desc_openai_compatible": "Any self-hosted endpoint speaking the OpenAI API — llama.cpp, vLLM, LocalAI, Jan, LiteLLM and others.",+ "provider_desc_openai_compatible": "Point Trilium at any endpoint that speaks the OpenAI API.","api_key_optional_description": "Optional. Only needed if your endpoint is behind an authenticating proxy or gateway.","setup_hint_ollama": "Ollama must be running on this address — start it with <Code>ollama serve</Code> if it isn't.","setup_hint_lmstudio": "Start the server in LM Studio under the Developer tab, then check the port shown there matches this address.",- "setup_hint_openai_compatible": "The address of your server's OpenAI-compatible API, usually ending in <Code>/v1</Code>.",+ "setup_hint_openai_compatible": "The base URL of the OpenAI-compatible API, usually ending in <Code>/v1</Code>.","troubleshoot_server_running": "Is the server running on the machine you expect?","troubleshoot_port": "Does the port in the URL match the one the server reports?","troubleshoot_remote": "If the server is on another machine, is it configured to accept connections from the network rather than localhost only?",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.tsindex b8ce7bca5c..fe31861c5d 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@@ -32,16 +32,27 @@ describe("AddProviderModal provider cards", () => {}});- it("sorts every card into a billing section, with the local one matching the self-hosted set", () => {- // Groups follow the user guide's taxonomy: metered API keys, a fixed-fee- // subscription reused from elsewhere, and self-hosted. `group` and- // `baseUrl` are independent fields describing the same split for the local- // set, so a card added to one and not the other would land in the wrong section.+ it("sorts every card into a section by how it is billed and where it runs", () => {+ // Groups follow the user guide's taxonomy — metered API keys, a fixed-fee+ // subscription reused from elsewhere, self-hosted — plus a custom-endpoint+ // 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"]);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)).toEqual(SELF_HOSTED);+ expect(PROVIDER_TYPES.filter(p => p.group === "local").map(p => p.id))+ .toEqual(["ollama", "lmstudio"]);+ expect(PROVIDER_TYPES.filter(p => p.group === "custom").map(p => p.id))+ .toEqual(["openai-compatible"]);+ // Every card lands in exactly one section.+ expect(PROVIDER_TYPES.filter(p => p.group === undefined)).toEqual([]);+ });++ it("keeps the endpoint-driven cards together regardless of section", () => {+ // `group` and `baseUrl` are independent fields: splitting the custom+ // endpoint out of "local" must not stop it asking for a URL.+ expect(PROVIDER_TYPES.filter(p => p.baseUrl === "required").map(p => p.id)).toEqual(SELF_HOSTED);});it("bills every subscription provider through an existing account rather than a key", () => {diff --git a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsxindex 8b96e6fd58..5edcb0934e 100644--- a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx@@ -77,7 +77,11 @@ export interface ProviderType {const PROVIDER_GROUPS = [{ id: "cloud", headingKey: "llm.provider_group_cloud", descriptionKey: "llm.provider_group_cloud_description" },{ id: "subscription", headingKey: "llm.provider_group_subscription", descriptionKey: "llm.provider_group_subscription_description" },- { id: "local", headingKey: "llm.provider_group_local", descriptionKey: "llm.provider_group_local_description" }+ { id: "local", headingKey: "llm.provider_group_local", descriptionKey: "llm.provider_group_local_description" },+ // Kept apart from the local runtimes: the same card reaches a hosted+ // OpenAI-compatible service (OpenRouter, Groq, …), so neither "no usage cost"+ // nor "stays on your machine" can be claimed for it.+ { id: "custom", headingKey: "llm.provider_group_custom", descriptionKey: "llm.provider_group_custom_description" }] as const;type ProviderGroupId = (typeof PROVIDER_GROUPS)[number]["id"];@@ -102,7 +106,7 @@ export const PROVIDER_TYPES: ProviderType[] = [setupHintKey: "llm.setup_hint_lmstudio", apiKey: "none", baseUrl: "required"},{- id: "openai-compatible", name: t("llm.provider_openai_compatible"), group: "local", defaultBaseUrl: "http://localhost:8080/v1",+ id: "openai-compatible", name: t("llm.provider_openai_compatible"), group: "custom", defaultBaseUrl: "http://localhost:8080/v1",iconUrl: openAiCompatibleIcon, description: t("llm.provider_desc_openai_compatible"),setupHintKey: "llm.setup_hint_openai_compatible", apiKey: "optional", baseUrl: "required"}@@ -374,7 +378,10 @@ export default function AddProviderModal({ show, onHidden, onSave, existingProviselected={selectedModels}onChange={setSelectedModels}autoSelectDefaults={seedDefaultModels}- troubleshooting={providerType?.baseUrl === "required" ? <SelfHostedTroubleshooting /> : undefined}+ // Only for the local runtimes: the checklist is about starting a+ // server on your own machine, which says nothing useful about a+ // hosted endpoint failing to list.+ troubleshooting={providerType?.group === "local" ? <SelfHostedTroubleshooting /> : undefined}/></CardSection></Card>