Skip to content

feat(llm): support multiple provider instances per type - #180

Open
TriplEight wants to merge 1 commit into
vas3k:mainfrom
TriplEight:feat/llm-provider-instances
Open

feat(llm): support multiple provider instances per type#180
TriplEight wants to merge 1 commit into
vas3k:mainfrom
TriplEight:feat/llm-provider-instances

Conversation

@TriplEight

@TriplEight TriplEight commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Allows users to add, remove, and reorder multiple LLM provider cards for each of the four provider types (OpenAI, Google, Mistral, OpenAI-compatible). Previously each type supported only a single instance.

How it works

Provider configuration is stored as a single llm_provider_instances JSON blob (one Setting row). The array order is the fallback priority order consumed by the existing requestLLM loop — no changes to ai/providers/llmProvider.ts.

Each instance: {id, kind, apiKey, model, baseUrl, maxConcurrency}.

  • Add: dropdown + button appends a default instance of the chosen kind.
  • Remove: per-card X button.
  • Reorder: drag-to-reorder reorders the array directly.
  • Test: per-card Test button passes the instance values with kind as provider.
image

Scope

Self-hosted only. The cloud path in getLLMSettings and the isSelfHosted gate are unchanged. No Prisma migration (reuses the Setting table). No changes to ai/providers/llmProvider.ts.

@TriplEight
TriplEight force-pushed the feat/llm-provider-instances branch 2 times, most recently from 310743a to 839af32 Compare August 13, 2026 12:57
Replace single-instance per-provider settings with a unified
llm_provider_instances JSON blob (array order = fallback order).
Users can add/remove/reorder provider cards for all four kinds
(OpenAI, Google, Mistral, OpenAI-compatible).

- lib/llm-providers.ts: instance helpers, blob parse/serialize,
  legacy migration, resolveInstances, hasConfiguredProvider
- models/settings.ts: getLLMSettings reads blob -> LLMConfig[]
- forms/settings.ts: single llm_provider_instances field
- llm-settings-form.tsx: instance-array state, DnD reorder,
  add/remove controls, per-card Test
- welcome-widget + unsorted page: use hasConfiguredProvider
- self-hosted setup: stop pre-filling API keys from env (security)
- self-hosted setup: add model name field for openai_compatible
@TriplEight
TriplEight force-pushed the feat/llm-provider-instances branch from 839af32 to cfe75fc Compare August 13, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant