7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
feat(dashboard): always-unify models, per-model providers page, intelligence-sorted Playground (#347)
Tashfeenc59634ab7a09
diff --git a/client/src/App.tsx b/client/src/App.tsxindex 26f1e938..d4db5f8c 100644--- a/client/src/App.tsx+++ b/client/src/App.tsx@@ -22,6 +22,7 @@ import { logout } from '@/lib/api'import KeysPage from '@/pages/KeysPage'import PlaygroundPage from '@/pages/PlaygroundPage'import FallbackPage from '@/pages/FallbackPage'+import ModelDetailPage from '@/pages/ModelDetailPage'import FusionPage from '@/pages/FusionPage'import EmbeddingsPage from '@/pages/EmbeddingsPage'import AnalyticsPage from '@/pages/AnalyticsPage'@@ -237,6 +238,7 @@ function App() {<Route path="/" element={<Navigate to="/models/chat" replace />} /><Route path="/models" element={<Navigate to="/models/chat" replace />} /><Route path="/models/chat" element={<FallbackPage />} />+ <Route path="/models/chat/:id" element={<ModelDetailPage />} /><Route path="/models/fusion" element={<FusionPage />} /><Route path="/models/embeddings" element={<EmbeddingsPage />} /><Route path="/playground" element={<PlaygroundPage />} />diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.jsonindex a1020522..987ec9f2 100644--- a/client/src/i18n/locales/en.json+++ b/client/src/i18n/locales/en.json@@ -87,6 +87,14 @@"dragToReorder": "Drag to reorder","dragToReorderGroup": "Drag to reorder model","providerCount": "{count} providers",+ "servedBy": "Served by {providers}",+ "viewProviders": "View providers",+ "backToModels": "Back to models",+ "providersHeading": "Providers serving this model",+ "codeSnippetHeading": "Use this model",+ "modelNotFound": "This model is not available, or it has no configured providers.",+ "providerIdsHeading": "Provider model ids",+ "providerIdsHint": "Send the unified model id to fail over across every provider, or a provider-specific id to pin one provider.","aggregateBudget": "{count}/mo","aggregateBudgetTitle": "Total free tokens per month across this model's providers","rateRpm": "{count} RPM",diff --git a/client/src/lib/model-groups.ts b/client/src/lib/model-groups.tsindex 05c4202d..df1255c5 100644--- a/client/src/lib/model-groups.ts+++ b/client/src/lib/model-groups.ts@@ -14,27 +14,61 @@ export interface PickerEntry {groupKey?: stringcanonicalId?: stringgroupLabel?: string+ intelligenceRank?: number+ sizeLabel?: string}export interface ModelOption {value: string // what to send as `model`: canonicalId (ON) or model_id (OFF)label: stringplatform: string // meaningful when providerCount === 1+ platforms: string[] // every provider serving this model (for the "N providers" affordance)providerCount: number+ // Sort axes for "by intelligence": the catalog's intelligence_rank is per-+ // provider, not global (issue #135), so the dashboard orders by size tier+ // first, then rank within the tier — mirroring the server's intelligence+ // preset. For a group these hold the BEST (most capable) member's values.+ sizeTier: number // Frontier=1, Large=2, Medium=3, Small=4, unknown=5+ intelligenceRank: number+}++const SIZE_TIER: Record<string, number> = { Frontier: 1, Large: 2, Medium: 3, Small: 4 }+export function sizeTier(label?: string): number {+ return SIZE_TIER[label ?? ''] ?? 5}export function buildModelOptions(entries: PickerEntry[], unifyOn: boolean): ModelOption[] {if (!unifyOn) {- return entries.map(e => ({ value: e.modelId, label: e.displayName, platform: e.platform, providerCount: 1 }))+ return entries.map(e => ({+ value: e.modelId, label: e.displayName, platform: e.platform,+ platforms: [e.platform], providerCount: 1,+ sizeTier: sizeTier(e.sizeLabel), intelligenceRank: e.intelligenceRank ?? 999,+ }))}// Group by groupKey (falling back to model_id for ungrouped rows), preserving- // first-seen order so the list still respects the server's ordering.+ // first-seen order so the list still respects the server's ordering. Within a+ // group, keep the best member's (tier, rank) so "sort by intelligence" ranks+ // the group by its most capable provider, and collect every provider name.const groups = new Map<string, ModelOption>()for (const e of entries) {const key = e.groupKey ?? e.modelId+ const tier = sizeTier(e.sizeLabel)+ const rank = e.intelligenceRank ?? 999const existing = groups.get(key)- if (existing) existing.providerCount++- else groups.set(key, { value: e.canonicalId ?? e.modelId, label: e.groupLabel ?? e.displayName, platform: e.platform, providerCount: 1 })+ if (existing) {+ existing.providerCount+++ existing.platforms.push(e.platform)+ if (tier < existing.sizeTier || (tier === existing.sizeTier && rank < existing.intelligenceRank)) {+ existing.sizeTier = tier+ existing.intelligenceRank = rank+ }+ } else {+ groups.set(key, {+ value: e.canonicalId ?? e.modelId, label: e.groupLabel ?? e.displayName,+ platform: e.platform, platforms: [e.platform], providerCount: 1,+ sizeTier: tier, intelligenceRank: rank,+ })+ }}return [...groups.values()]}diff --git a/client/src/pages/FallbackPage.tsx b/client/src/pages/FallbackPage.tsxindex 85b74f1a..c73b119a 100644--- a/client/src/pages/FallbackPage.tsx+++ b/client/src/pages/FallbackPage.tsx@@ -1,4 +1,4 @@-import { Fragment, useEffect, useState, useRef, type ReactNode } from 'react'+import { useEffect, useState, useRef, type ReactNode } from 'react'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'import {DndContext,@@ -18,6 +18,7 @@ import {} from '@dnd-kit/sortable'import { CSS } from '@dnd-kit/utilities'import { ChevronDown, SlidersHorizontal } from 'lucide-react'+import { Link, useNavigate } from 'react-router-dom'import { useI18n } from '@/i18n'import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'@@ -28,7 +29,7 @@ import { FloatingBar } from '@/components/floating-bar'import { ModelsTabs } from '@/components/models-tabs'import { Tooltip } from '@/components/tooltip'-interface FallbackEntry {+export interface FallbackEntry {modelDbId: numberpriority: numbereffectivePriority: number@@ -61,7 +62,7 @@ type RoutingStrategy = 'priority' | 'balanced' | 'smartest' | 'fastest' | 'reliatype RoutingWeights = { reliability: number; speed: number; intelligence: number }-interface RoutingScore {+export interface RoutingScore {modelDbId: numberreliability: numberspeed: number@@ -72,7 +73,7 @@ interface RoutingScore {totalRequests: number}-interface RoutingData {+export interface RoutingData {strategy: RoutingStrategyweights: RoutingWeights | nullcustomWeights: RoutingWeights@@ -80,7 +81,7 @@ interface RoutingData {}// A merged row: fallback-chain metadata + live bandit scores.-type Row = FallbackEntry & Partial<RoutingScore>+export type Row = FallbackEntry & Partial<RoutingScore>// `tKey` is the i18n suffix under `strategies.*` (label) and `strategies.*Blurb`.// It differs from the routing `key` for Manual, whose strategy id is 'priority'.@@ -201,7 +202,7 @@ function CustomWeightsPopover({ saved, onSave, saving }: {)}-function formatTokens(n: number): string {+export function formatTokens(n: number): string {if (n >= 1_000_000_000) return `${(n / 1_000_000_000).toFixed(1)}B`if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`@@ -212,7 +213,7 @@ function formatTokens(n: number): string {// Strips the catalog's decorative bits ("free · ", " per IP", "~", "?") so e.g.// "free · 40 RPM" → "40 RPM", "free · 200/hr per IP" → "200/hr", "~? (anon)" →// "anon". Returns null when nothing meaningful remains.-function cleanQuotaLabel(s: string | undefined): string | null {+export function cleanQuotaLabel(s: string | undefined): string | null {if (!s) return nulllet c = s.replace(/free\s*·\s*/ig, '')@@ -224,6 +225,25 @@ function cleanQuotaLabel(s: string | undefined): string | null {return c || null}+// The quota badge for a logical model: its summed monthly token budget when it+// has one (you can spend all providers' budgets via failover), else the best+// rate cap (RPM/RPD, or the catalog's rate label) for rate-limited providers.+// Shared by the Models-page group header and the per-model detail page.+export function groupQuotaBadge(+ members: Row[],+ t: (key: string, vars?: Record<string, string | number>) => string,+): { text: string; title: string } | null {+ const totalBudget = members.reduce((sum, m) => sum + (m.monthlyTokenBudgetTokens ?? 0), 0)+ const maxRpm = Math.max(0, ...members.map(m => m.rpmLimit ?? 0))+ const maxRpd = Math.max(0, ...members.map(m => m.rpdLimit ?? 0))+ const rateLabelText = members.map(m => cleanQuotaLabel(m.monthlyTokenBudget)).find(Boolean) ?? null+ if (totalBudget > 0) return { text: t('models.aggregateBudget', { count: formatTokens(totalBudget) }), title: t('models.aggregateBudgetTitle') }+ if (maxRpm > 0) return { text: t('models.rateRpm', { count: maxRpm }), title: t('models.rateTitle') }+ if (maxRpd > 0) return { text: t('models.rateRpd', { count: maxRpd }), title: t('models.rateTitle') }+ if (rateLabelText) return { text: rateLabelText, title: t('models.rateTitle') }+ return null+}+interface TokenUsageData {totalBudget: numbertotalUsed: number@@ -249,7 +269,7 @@ const platformColors: Record<string, string> = {}// A 0..1 value as a thin horizontal bar with the number beside it.-function AxisBar({ value, color }: { value: number | undefined; color: string }) {+export function AxisBar({ value, color }: { value: number | undefined; color: string }) {const v = value ?? 0return (<div className="flex items-center gap-1.5">@@ -359,8 +379,43 @@ function TokenUsageBar({ data }: { data: TokenUsageData }) {)}+// The shared table header for the unified model/provider table — used by the+// Models page and the per-model detail page so their columns line up.+export function ModelTableHead() {+ const { t } = useI18n()+ return (+ <thead>+ <tr className="text-left text-muted-foreground border-b">+ <th className="py-2 pl-3 pr-1 w-6"></th>+ <th className="py-2 pr-2 w-6 text-center font-medium">#</th>+ <th className="py-2 pr-3 font-medium">{t('models.columnModel')}</th>+ <th className="py-2 pr-3 font-medium">+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#22c55e' }} />{t('strategies.weightReliability')}</span>+ </th>+ <th className="py-2 pr-3 font-medium">+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#3b82f6' }} />{t('strategies.weightSpeed')}</span>+ </th>+ <th className="py-2 pr-3 font-medium">+ <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#a855f7' }} />{t('strategies.weightIntelligence')}</span>+ </th>+ <th className="py-2 pr-3 font-medium">+ <Tooltip text={t('strategies.guardrailsTooltip')}>+ <span className="underline decoration-dotted underline-offset-2 cursor-help">{t('strategies.guardrails')}</span>+ </Tooltip>+ </th>+ <th className="py-2 pr-3 font-medium text-right">+ <Tooltip text={t('strategies.scoreTooltip')}>+ <span className="underline decoration-dotted underline-offset-2 cursor-help">{t('strategies.scoreColumn')}</span>+ </Tooltip>+ </th>+ <th className="py-2 pr-3 font-medium text-right">{t('models.columnOn')}</th>+ </tr>+ </thead>+ )+}+// ── One row of the unified table ────────────────────────────────────────────-function RowContent({+export function RowContent({row,rank,draggable,@@ -434,34 +489,6 @@ function RowContent({)}-function SortableRow({ row, rank, onToggle }: { row: Row; rank: number; onToggle: (id: number, e: boolean) => void }) {- const { t } = useI18n()- const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.modelDbId })- const handle = (- <button- {...attributes}- {...listeners}- className="cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-foreground transition-colors"- aria-label={t('models.dragToReorder')}- >- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">- <circle cx="9" cy="6" r="1.5" /><circle cx="15" cy="6" r="1.5" />- <circle cx="9" cy="12" r="1.5" /><circle cx="15" cy="12" r="1.5" />- <circle cx="9" cy="18" r="1.5" /><circle cx="15" cy="18" r="1.5" />- </svg>- </button>- )- return (- <tr- ref={setNodeRef}- style={{ transform: CSS.Transform.toString(transform), transition }}- className={`border-b last:border-0 bg-card ${isDragging ? 'opacity-50' : ''} ${row.enabled ? '' : 'opacity-50'}`}- >- <RowContent row={row} rank={rank} draggable dragHandle={handle} onToggle={onToggle} />- </tr>- )-}-// ── Grouped (unified) rendering ──────────────────────────────────────────────// One logical model and the provider rows that serve it.interface ModelGroupRow {@@ -506,11 +533,9 @@ const dragDots = (// The collapsed header row for a logical-model group: name, provider count,// union vision/tools badges, the best member's axis bars + score, and a single// switch that enables/disables every provider in the group.-function GroupHeaderCells({ group, rank, expanded, onToggleExpand, dragHandle, onToggleGroup }: {+function GroupHeaderCells({ group, rank, dragHandle, onToggleGroup }: {group: ModelGroupRowrank: number- expanded: boolean- onToggleExpand: () => voiddragHandle?: ReactNodeonToggleGroup: (memberIds: number[], enabled: boolean) => void}) {@@ -521,35 +546,22 @@ function GroupHeaderCells({ group, rank, expanded, onToggleExpand, dragHandle, oconst guard = (best.headroom ?? 1) * (best.rateLimit ?? 1)const vision = group.members.some(m => m.supportsVision)const tools = group.members.some(m => m.supportsTools)- // Quota badge beside the name: the aggregated monthly token budget when the- // group has one (summed across providers — you can spend all of them via- // failover), otherwise the model's rate cap (RPM/RPD, or the catalog's rate- // label) for rate-limited providers like NVIDIA.- const totalBudget = group.members.reduce((sum, m) => sum + (m.monthlyTokenBudgetTokens ?? 0), 0)- const maxRpm = Math.max(0, ...group.members.map(m => m.rpmLimit ?? 0))- const maxRpd = Math.max(0, ...group.members.map(m => m.rpdLimit ?? 0))- const rateLabelText = group.members.map(m => cleanQuotaLabel(m.monthlyTokenBudget)).find(Boolean) ?? null- // A summed monthly token budget if the group has one, else a rate cap (RPM/RPD,- // or the catalog's rate label) for rate-limited providers like NVIDIA.- function quotaBadge(): { text: string; title: string } | null {- if (totalBudget > 0) return { text: t('models.aggregateBudget', { count: formatTokens(totalBudget) }), title: t('models.aggregateBudgetTitle') }- if (maxRpm > 0) return { text: t('models.rateRpm', { count: maxRpm }), title: t('models.rateTitle') }- if (maxRpd > 0) return { text: t('models.rateRpd', { count: maxRpd }), title: t('models.rateTitle') }- if (rateLabelText) return { text: rateLabelText, title: t('models.rateTitle') }- return null- }- const quota = quotaBadge()+ const quota = groupQuotaBadge(group.members, t)+ // The model name links to its own page, which lists every provider that serves+ // it (replaces the old inline expansion).+ const detailId = encodeURIComponent(group.members[0].canonicalId ?? group.members[0].modelId)return (<><td className="py-2 pl-3 pr-1 w-6 align-middle">{dragHandle ?? <span className="text-muted-foreground/30 select-none">·</span>}</td><td className="py-2 pr-2 w-6 text-center font-mono text-xs text-muted-foreground tabular-nums align-middle">{rank}</td><td className="py-2 pr-3 align-middle">- <button type="button" onClick={onToggleExpand} className="flex items-center gap-2 flex-wrap text-left" aria-expanded={expanded}>- <ChevronDown className={`size-4 flex-shrink-0 text-muted-foreground transition-transform ${expanded ? '' : '-rotate-90'}`} />+ <Link to={`/models/chat/${detailId}`} aria-label={t('models.viewProviders')} onClick={e => e.stopPropagation()} className="flex items-center gap-2 flex-wrap text-left"><span className="font-medium text-sm">{group.label}</span>{solo? <span className="text-xs text-muted-foreground">{group.members[0].platform}</span>- : <span className="text-[10px] rounded-full px-1.5 py-0.5 bg-muted text-muted-foreground">{t('models.providerCount', { count: group.members.length })}</span>}+ : <Tooltip text={t('models.servedBy', { providers: group.members.map(m => m.platform).join(', ') })}>+ <span className="text-[10px] rounded-full px-1.5 py-0.5 bg-muted text-muted-foreground">{t('models.providerCount', { count: group.members.length })}</span>+ </Tooltip>}{quota && (<span title={quota.title} className="text-[10px] rounded-full px-1.5 py-0.5 bg-muted text-muted-foreground tabular-nums">{quota.text}@@ -561,34 +573,35 @@ function GroupHeaderCells({ group, rank, expanded, onToggleExpand, dragHandle, o{tools && (<span title={t('models.toolsTitle')} className="text-[10px] rounded-full px-1.5 py-0.5 bg-violet-600/15 text-violet-700 dark:bg-violet-400/15 dark:text-violet-400">{t('models.tools')}</span>)}- </button>+ </Link></td><td className="py-2 pr-3 align-middle"><AxisBar value={best.reliability} color="#22c55e" /></td><td className="py-2 pr-3 align-middle"><AxisBar value={best.speed} color="#3b82f6" /></td><td className="py-2 pr-3 align-middle"><AxisBar value={best.intelligence} color="#a855f7" /></td><td className="py-2 pr-3 align-middle font-mono text-[11px] text-muted-foreground tabular-nums">{guard < 0.999 ? `×${guard.toFixed(2)}` : '—'}</td><td className="py-2 pr-3 align-middle text-right font-mono text-xs font-medium tabular-nums">{best.score !== undefined ? best.score.toFixed(3) : '–'}</td>- <td className="py-2 pr-3 align-middle text-right">+ <td className="py-2 pr-3 align-middle text-right" onClick={e => e.stopPropagation()}><Switch checked={anyEnabled} onCheckedChange={(c) => onToggleGroup(group.members.map(m => m.modelDbId), c)} /></td></>)}-function SortableGroupRow({ group, rank, expanded, onToggleExpand, onToggleGroup }: {+function SortableGroupRow({ group, rank, onToggleGroup }: {group: ModelGroupRowrank: number- expanded: boolean- onToggleExpand: () => voidonToggleGroup: (memberIds: number[], enabled: boolean) => void}) {const { t } = useI18n()const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: `grp:${group.key}` })const anyEnabled = group.members.some(m => m.enabled)+ const navigate = useNavigate()+ const detailId = encodeURIComponent(group.members[0].canonicalId ?? group.members[0].modelId)const handle = (<button{...attributes}{...listeners}+ onClick={e => e.stopPropagation()}className="cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-foreground transition-colors"aria-label={t('models.dragToReorderGroup')}>@@ -599,15 +612,17 @@ function SortableGroupRow({ group, rank, expanded, onToggleExpand, onToggleGroup<trref={setNodeRef}style={{ transform: CSS.Transform.toString(transform), transition }}- className={`border-b last:border-0 bg-card ${isDragging ? 'opacity-50' : ''} ${anyEnabled ? '' : 'opacity-50'}`}+ onClick={() => navigate(`/models/chat/${detailId}`)}+ className={`border-b last:border-0 bg-card cursor-pointer transition-colors hover:[&>td]:bg-muted/50 [&>td:first-child]:rounded-l-lg [&>td:last-child]:rounded-r-lg ${isDragging ? 'opacity-50' : ''} ${anyEnabled ? '' : 'opacity-50'}`}>- <GroupHeaderCells group={group} rank={rank} expanded={expanded} onToggleExpand={onToggleExpand} dragHandle={handle} onToggleGroup={onToggleGroup} />+ <GroupHeaderCells group={group} rank={rank} dragHandle={handle} onToggleGroup={onToggleGroup} /></tr>)}export default function FallbackPage() {const { t } = useI18n()+ const navigate = useNavigate()const queryClient = useQueryClient()const [localEntries, setLocalEntries] = useState<FallbackEntry[] | null>(null)@@ -654,65 +669,22 @@ export default function FallbackPage() {// Entry fields win on overlap: the routing snapshot also carries `enabled`// (and identity fields), which would otherwise clobber unsaved local toggles.const rows: Row[] = configured.map(e => ({ ...(scoreById.get(e.modelDbId) ?? {}), ...e }))- // Manual → the order you set (by priority). Bandit → ranked by live score.- const ordered = isManual- ? [...rows].sort((a, b) => a.priority - b.priority)- : [...rows].sort((a, b) => (b.score ?? 0) - (a.score ?? 0))const sensors = useSensors(useSensor(PointerSensor),useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),)- function handleDragEnd(event: DragEndEvent) {- const { active, over } = event- if (!over || active.id === over.id) return- const oldIndex = ordered.findIndex(e => e.modelDbId === active.id)- const newIndex = ordered.findIndex(e => e.modelDbId === over.id)- const reorderedVisible = arrayMove(ordered, oldIndex, newIndex)- const unconfigured = allEntries.filter(e => e.keyCount === 0)- const merged: FallbackEntry[] = [- ...reorderedVisible.map((e, i) => ({ ...(e as FallbackEntry), priority: i + 1 })),- ...unconfigured.map((e, i) => ({ ...e, priority: reorderedVisible.length + i + 1 })),- ]- setLocalEntries(merged)- }-- function handleToggle(modelDbId: number, enabled: boolean) {- setLocalEntries(allEntries.map(e => (e.modelDbId === modelDbId ? { ...e, enabled } : e)))- }-function handleSave() {saveMutation.mutate(allEntries.map(e => ({ modelDbId: e.modelDbId, priority: e.priority, enabled: e.enabled })))}const hasChanges = localEntries !== null- // ── Model unification (group the same model across providers) ──────────────- const { data: unify } = useQuery<{ enabled: boolean }>({- queryKey: ['unify'],- queryFn: () => apiFetch('/api/settings/unify'),- })- const unifyOn = unify?.enabled ?? true- const unifyMutation = useMutation({- mutationFn: (enabled: boolean) => apiFetch('/api/settings/unify', { method: 'PUT', body: JSON.stringify({ enabled }) }),- onSuccess: () => {- queryClient.invalidateQueries({ queryKey: ['unify'] })- queryClient.invalidateQueries({ queryKey: ['fallback'] })- },- })- const [expandedGroups, setExpandedGroups] = useState<Set<string>>(() => new Set())+ // ── Model unification: a model served by several providers is always shown as+ // one logical row that links to its own page (the on/off toggle was removed). ─const orderedGroups = buildGroups(rows, isManual)- function toggleExpand(key: string) {- setExpandedGroups(prev => {- const next = new Set(prev)- if (next.has(key)) next.delete(key)- else next.add(key)- return next- })- }-function handleGroupToggle(memberIds: number[], enabled: boolean) {const ids = new Set(memberIds)setLocalEntries(allEntries.map(e => (ids.has(e.modelDbId) ? { ...e, enabled } : e)))@@ -728,62 +700,17 @@ export default function FallbackPage() {setLocalEntries(allEntries.map(e => ({ ...e, priority: prio.get(e.modelDbId) ?? e.priority })))}+ // Reorder models (the failover priority order). Providers within a model are+ // ordered by the active strategy and managed on the model's own page.function handleGroupedDragEnd(event: DragEndEvent) {const { active, over } = eventif (!over || active.id === over.id) return- const a = String(active.id)- const o = String(over.id)- if (a.startsWith('grp:')) {- if (!o.startsWith('grp:')) return // a group dropped on a member row — ignore- const oldI = orderedGroups.findIndex(g => `grp:${g.key}` === a)- const newI = orderedGroups.findIndex(g => `grp:${g.key}` === o)- if (oldI < 0 || newI < 0) return- persistGroupOrder(arrayMove(orderedGroups, oldI, newI))- } else {- // Member reorder, constrained to within its own group.- const activeId = Number(a)- const overId = Number(o)- const gi = orderedGroups.findIndex(g => g.members.some(m => m.modelDbId === activeId))- if (gi < 0) return- const members = orderedGroups[gi].members- const oldI = members.findIndex(m => m.modelDbId === activeId)- const newI = members.findIndex(m => m.modelDbId === overId)- if (newI < 0) return // dropped outside its group — ignore- const next = orderedGroups.map((g, i) => (i === gi ? { ...g, members: arrayMove(g.members, oldI, newI) } : g))- persistGroupOrder(next)- }+ const oldI = orderedGroups.findIndex(g => `grp:${g.key}` === String(active.id))+ const newI = orderedGroups.findIndex(g => `grp:${g.key}` === String(over.id))+ if (oldI < 0 || newI < 0) return+ persistGroupOrder(arrayMove(orderedGroups, oldI, newI))}- const tableHead = (- <thead>- <tr className="text-left text-muted-foreground border-b">- <th className="py-2 pl-3 pr-1 w-6"></th>- <th className="py-2 pr-2 w-6 text-center font-medium">#</th>- <th className="py-2 pr-3 font-medium">{t('models.columnModel')}</th>- <th className="py-2 pr-3 font-medium">- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#22c55e' }} />{t('strategies.weightReliability')}</span>- </th>- <th className="py-2 pr-3 font-medium">- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#3b82f6' }} />{t('strategies.weightSpeed')}</span>- </th>- <th className="py-2 pr-3 font-medium">- <span className="inline-flex items-center gap-1"><span className="size-2 rounded-sm" style={{ background: '#a855f7' }} />{t('strategies.weightIntelligence')}</span>- </th>- <th className="py-2 pr-3 font-medium">- <Tooltip text={t('strategies.guardrailsTooltip')}>- <span className="underline decoration-dotted underline-offset-2 cursor-help">{t('strategies.guardrails')}</span>- </Tooltip>- </th>- <th className="py-2 pr-3 font-medium text-right">- <Tooltip text={t('strategies.scoreTooltip')}>- <span className="underline decoration-dotted underline-offset-2 cursor-help">{t('strategies.scoreColumn')}</span>- </Tooltip>- </th>- <th className="py-2 pr-3 font-medium text-right">{t('models.columnOn')}</th>- </tr>- </thead>- )-return (<div><PageHeader@@ -842,20 +769,10 @@ export default function FallbackPage() {</p></section>- {/* Unify duplicate models — collapse the same model served by several- providers into one expandable row (and one /v1/models entry). */}- <section className="flex items-center justify-between rounded-3xl border bg-card p-5">- <div className="min-w-0 pr-4">- <h2 className="text-sm font-medium">{t('models.unifyToggle')}</h2>- <p className="mt-0.5 text-xs text-muted-foreground">{t('models.unifyToggleHint')}</p>- </div>- <Switch checked={unifyOn} onCheckedChange={(c) => unifyMutation.mutate(c)} disabled={unifyMutation.isPending} />- </section>-{/* Unified routing / fallback table */}{isLoading ? (<p className="text-sm text-muted-foreground">{t('common.loading')}</p>- ) : ordered.length === 0 ? (+ ) : orderedGroups.length === 0 ? (<div className="rounded-3xl border border-dashed p-8 text-center"><p className="text-sm text-muted-foreground">{t('models.noModelsBefore')}<a href="/keys" className="underline text-foreground">{t('models.keysPageLink')}</a>{t('models.noModelsAfter')}@@ -865,73 +782,15 @@ export default function FallbackPage() {<>{/* DndContext must wrap OUTSIDE the table: it renders hidden a11ylive-region <div>s, which are invalid as direct <table> children. */}- {unifyOn ? (- isManual ? (- <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleGroupedDragEnd}>- <div className="rounded-2xl border overflow-x-auto">- <table className="w-full text-sm">- {tableHead}- <SortableContext items={orderedGroups.map(g => `grp:${g.key}`)} strategy={verticalListSortingStrategy}>- <tbody>- {orderedGroups.map((g, gi) => (- <Fragment key={g.key}>- <SortableGroupRow- group={g}- rank={gi + 1}- expanded={expandedGroups.has(g.key)}- onToggleExpand={() => toggleExpand(g.key)}- onToggleGroup={handleGroupToggle}- />- {expandedGroups.has(g.key) && (- <SortableContext items={g.members.map(m => m.modelDbId)} strategy={verticalListSortingStrategy}>- {g.members.map((m, mi) => (- <SortableRow key={m.modelDbId} row={m} rank={mi + 1} onToggle={handleToggle} />- ))}- </SortableContext>- )}- </Fragment>- ))}- </tbody>- </SortableContext>- </table>- </div>- </DndContext>- ) : (- <div className="rounded-2xl border overflow-x-auto">- <table className="w-full text-sm">- {tableHead}- <tbody>- {orderedGroups.map((g, gi) => (- <Fragment key={g.key}>- <tr className={`border-b last:border-0 ${g.members.some(m => m.enabled) ? '' : 'opacity-50'}`}>- <GroupHeaderCells- group={g}- rank={gi + 1}- expanded={expandedGroups.has(g.key)}- onToggleExpand={() => toggleExpand(g.key)}- onToggleGroup={handleGroupToggle}- />- </tr>- {expandedGroups.has(g.key) && g.members.map((m, mi) => (- <tr key={m.modelDbId} className={`border-b last:border-0 bg-muted/20 ${m.enabled ? '' : 'opacity-50'}`}>- <RowContent row={m} rank={mi + 1} draggable={false} onToggle={handleToggle} />- </tr>- ))}- </Fragment>- ))}- </tbody>- </table>- </div>- )- ) : isManual ? (- <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>+ {isManual ? (+ <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleGroupedDragEnd}><div className="rounded-2xl border overflow-x-auto"><table className="w-full text-sm">- {tableHead}- <SortableContext items={ordered.map(e => e.modelDbId)} strategy={verticalListSortingStrategy}>+ <ModelTableHead />+ <SortableContext items={orderedGroups.map(g => `grp:${g.key}`)} strategy={verticalListSortingStrategy}><tbody>- {ordered.map((row, i) => (- <SortableRow key={row.modelDbId} row={row} rank={i + 1} onToggle={handleToggle} />+ {orderedGroups.map((g, gi) => (+ <SortableGroupRow key={g.key} group={g} rank={gi + 1} onToggleGroup={handleGroupToggle} />))}</tbody></SortableContext>@@ -941,11 +800,15 @@ export default function FallbackPage() {) : (<div className="rounded-2xl border overflow-x-auto"><table className="w-full text-sm">- {tableHead}+ <ModelTableHead /><tbody>- {ordered.map((row, i) => (- <tr key={row.modelDbId} className={`border-b last:border-0 ${row.enabled ? '' : 'opacity-50'}`}>- <RowContent row={row} rank={i + 1} draggable={false} onToggle={handleToggle} />+ {orderedGroups.map((g, gi) => (+ <tr+ key={g.key}+ onClick={() => navigate(`/models/chat/${encodeURIComponent(g.members[0].canonicalId ?? g.members[0].modelId)}`)}+ className={`border-b last:border-0 cursor-pointer transition-colors hover:[&>td]:bg-muted/50 [&>td:first-child]:rounded-l-lg [&>td:last-child]:rounded-r-lg ${g.members.some(m => m.enabled) ? '' : 'opacity-50'}`}+ >+ <GroupHeaderCells group={g} rank={gi + 1} onToggleGroup={handleGroupToggle} /></tr>))}</tbody>diff --git a/client/src/pages/ModelDetailPage.tsx b/client/src/pages/ModelDetailPage.tsxnew file mode 100644index 00000000..43865323--- /dev/null+++ b/client/src/pages/ModelDetailPage.tsx@@ -0,0 +1,153 @@+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'+import { Link, useParams } from 'react-router-dom'+import { ChevronLeft } from 'lucide-react'+import { useI18n } from '@/i18n'+import { apiFetch } from '@/lib/api'+import { CopyButton } from '@/components/copy-button'+import { PageHeader } from '@/components/page-header'+import { ModelsTabs } from '@/components/models-tabs'+import {+ ModelTableHead,+ RowContent,+ groupQuotaBadge,+ type FallbackEntry,+ type RoutingData,+ type Row,+} from './FallbackPage'++// One model's own page: lists every provider that serves it (this model now+// fails over across these providers). Reached from the Models list; replaces the+// old inline group expansion.+export default function ModelDetailPage() {+ const { t } = useI18n()+ const { id } = useParams<{ id: string }>()+ const canonicalId = id ? decodeURIComponent(id) : ''+ const queryClient = useQueryClient()++ const { data: entries = [], isLoading } = useQuery<FallbackEntry[]>({+ queryKey: ['fallback'],+ queryFn: () => apiFetch('/api/fallback'),+ })+ const { data: routing } = useQuery<RoutingData>({+ queryKey: ['fallback', 'routing'],+ queryFn: () => apiFetch('/api/fallback/routing'),+ })+ const { data: keyData } = useQuery<{ apiKey: string }>({+ queryKey: ['unified-key'],+ queryFn: () => apiFetch('/api/settings/api-key'),+ })++ // Toggling a provider persists immediately (no save bar on this page): send the+ // full entries list with this one flipped, then refresh.+ const saveMutation = useMutation({+ mutationFn: (data: { modelDbId: number; priority: number; enabled: boolean }[]) =>+ apiFetch('/api/fallback', { method: 'PUT', body: JSON.stringify(data) }),+ onSuccess: () => queryClient.invalidateQueries({ queryKey: ['fallback'] }),+ })++ const isManual = (routing?.strategy ?? 'balanced') === 'priority'+ const scoreById = new Map((routing?.scores ?? []).map(s => [s.modelDbId, s]))++ // Providers serving this model: configured rows whose group matches the id+ // (canonicalId, or the bare model id for an ungrouped model).+ const members: Row[] = entries+ .filter(e => e.keyCount > 0 && (e.canonicalId ?? e.modelId) === canonicalId)+ .map(e => ({ ...(scoreById.get(e.modelDbId) ?? {}), ...e }))+ .sort((a, b) => (isManual ? a.priority - b.priority : (b.score ?? 0) - (a.score ?? 0)))++ function handleToggle(modelDbId: number, enabled: boolean) {+ saveMutation.mutate(entries.map(e => ({+ modelDbId: e.modelDbId,+ priority: e.priority,+ enabled: e.modelDbId === modelDbId ? enabled : e.enabled,+ })))+ }++ const label = members[0]?.groupLabel ?? members[0]?.displayName ?? canonicalId+ const quota = members.length ? groupQuotaBadge(members, t) : null+ const vision = members.some(m => m.supportsVision)+ const tools = members.some(m => m.supportsTools)++ // A ready-to-run request referencing this model by its unified id, so it fails+ // over across every provider above. Same base-URL derivation as the Keys page.+ const baseUrl = import.meta.env.DEV+ ? `http://${window.location.hostname}:${__SERVER_PORT__}/v1`+ : `${window.location.origin}/v1`+ const snippet = `curl ${baseUrl}/chat/completions \\+ -H "Authorization: Bearer ${keyData?.apiKey || 'YOUR_API_KEY'}" \\+ -H "Content-Type: application/json" \\+ -d '{+ "model": "${canonicalId}",+ "messages": [+ { "role": "user", "content": "Hello!" }+ ]+ }'`++ return (+ <div>+ <PageHeader title={label} description={t('models.providersHeading')} divider={false} actions={<ModelsTabs />} />++ <div className="space-y-6">+ <Link to="/models/chat" className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground">+ <ChevronLeft className="size-4" />{t('models.backToModels')}+ </Link>++ {isLoading ? (+ <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ ) : members.length === 0 ? (+ <div className="rounded-3xl border border-dashed p-8 text-center">+ <p className="text-sm text-muted-foreground">{t('models.modelNotFound')}</p>+ </div>+ ) : (+ <>+ {/* Summary badges */}+ <div className="flex items-center gap-2 flex-wrap">+ <span className="text-[11px] rounded-full px-2 py-0.5 bg-muted text-muted-foreground">{t('models.providerCount', { count: members.length })}</span>+ {quota && <span title={quota.title} className="text-[11px] rounded-full px-2 py-0.5 bg-muted text-muted-foreground tabular-nums">{quota.text}</span>}+ {vision && <span title={t('models.visionTitle')} className="text-[11px] rounded-full px-2 py-0.5 bg-cyan-600/15 text-cyan-700 dark:bg-cyan-400/15 dark:text-cyan-400">{t('models.vision')}</span>}+ {tools && <span title={t('models.toolsTitle')} className="text-[11px] rounded-full px-2 py-0.5 bg-violet-600/15 text-violet-700 dark:bg-violet-400/15 dark:text-violet-400">{t('models.tools')}</span>}+ </div>++ {/* Per-provider stats (same columns as the Models table) */}+ <div className="rounded-2xl border overflow-x-auto">+ <table className="w-full text-sm">+ <ModelTableHead />+ <tbody>+ {members.map((m, i) => (+ <tr key={m.modelDbId} className={`border-b last:border-0 ${m.enabled ? '' : 'opacity-50'}`}>+ <RowContent row={m} rank={i + 1} draggable={false} onToggle={handleToggle} />+ </tr>+ ))}+ </tbody>+ </table>+ </div>++ {/* The provider-specific model id to send if you want to pin one provider. */}+ <div className="rounded-2xl border bg-card p-4">+ <h2 className="text-sm font-medium">{t('models.providerIdsHeading')}</h2>+ <p className="mt-0.5 mb-3 text-xs text-muted-foreground">{t('models.providerIdsHint')}</p>+ <div className="space-y-1.5">+ {members.map(m => (+ <div key={m.modelDbId} className="flex items-center gap-2 text-xs">+ <span className="w-28 shrink-0 text-muted-foreground">{m.platform}</span>+ <code className="min-w-0 flex-1 truncate font-mono text-[11px]">{m.modelId}</code>+ <CopyButton text={m.modelId} />+ </div>+ ))}+ </div>+ </div>++ {/* Ready-to-run snippet that references this model by its unified id. */}+ <div className="overflow-hidden rounded-2xl border bg-card">+ <div className="flex items-center gap-2 border-b px-3 py-2">+ <CopyButton text={snippet} className="size-7 shrink-0" label={t('common.copy')} />+ <span className="text-xs font-medium">{t('models.codeSnippetHeading')}</span>+ </div>+ <pre className="overflow-x-auto px-4 py-3 text-[11px] leading-relaxed"><code className="font-mono">{snippet}</code></pre>+ </div>+ </>+ )}+ </div>+ </div>+ )+}diff --git a/client/src/pages/PlaygroundPage.tsx b/client/src/pages/PlaygroundPage.tsxindex 4139e646..77a40025 100644--- a/client/src/pages/PlaygroundPage.tsx+++ b/client/src/pages/PlaygroundPage.tsx@@ -5,6 +5,7 @@ import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover'import { buildModelOptions } from '@/lib/model-groups'+import { Tooltip } from '@/components/tooltip'import { PageHeader } from '@/components/page-header'import { Markdown } from '@/components/markdown'import { CopyButton } from '@/components/copy-button'@@ -18,6 +19,7 @@ interface FallbackEntry {modelId: stringdisplayName: stringsizeLabel: string+ intelligenceRank: numberkeyCount: number}@@ -129,15 +131,13 @@ export default function PlaygroundPage() {queryFn: () => apiFetch('/api/fallback'),})- const { data: unify } = useQuery<{ enabled: boolean }>({- queryKey: ['unify'],- queryFn: () => apiFetch('/api/settings/unify'),- })- const unifyOn = unify?.enabled ?? true+ // Unification is always on now (the on/off toggle was removed), so the picker+ // always collapses a model's providers into one option.+ const unifyOn = trueconst availableModels = fallbackEntries.filter(e => e.keyCount > 0 && e.enabled)- // When unify is on, collapse the same model from multiple providers into one- // option (value = canonical id, which the proxy resolves to the whole group).+ // Collapse the same model from multiple providers into one option (value =+ // canonical id, which the proxy resolves to the whole group).const modelOptions = buildModelOptions(availableModels, unifyOn)useEffect(() => {@@ -295,24 +295,32 @@ export default function PlaygroundPage() {inputRef.current?.focus()}- // Searchable picker options: auto + fusion pinned at the top, then every- // model sorted alphabetically A–Z by name.+ // Searchable picker options: auto + fusion pinned at the top, then every model+ // ordered BY INTELLIGENCE — size tier first (Frontier→Small), then the catalog+ // rank within the tier, name as the final tiebreaker. (Raw intelligence_rank is+ // per-provider, not global, so tier-first matches the server's preset; #135.)const pickerOptions = [- { value: 'auto', label: t('playground.autoModel'), sub: '', isNew: false },- { value: 'fusion', label: t('playground.fusionModel'), sub: '', isNew: true },+ { value: 'auto', label: t('playground.autoModel'), sub: '', isNew: false, platforms: [] as string[] },+ { value: 'fusion', label: t('playground.fusionModel'), sub: '', isNew: true, platforms: [] as string[] },...modelOptions+ .slice()+ .sort((a, b) =>+ a.sizeTier - b.sizeTier ||+ a.intelligenceRank - b.intelligenceRank ||+ a.label.localeCompare(b.label, undefined, { sensitivity: 'base' })).map(o => ({value: o.value,label: o.label,sub: o.providerCount > 1 ? t('models.providerCount', { count: o.providerCount }) : o.platform,isNew: false,- }))- .sort((a, b) => a.label.localeCompare(b.label, undefined, { sensitivity: 'base' })),+ // Provider names for the multi-provider hover + search; empty when solo.+ platforms: o.providerCount > 1 ? o.platforms : [],+ })),]- // Literal, case-insensitive substring match against name, provider, and id.+ // Literal, case-insensitive substring match against name, providers, and id.const modelQ = modelQuery.trim().toLowerCase()const filteredOptions = modelQ- ? pickerOptions.filter(o => `${o.label} ${o.sub} ${o.value}`.toLowerCase().includes(modelQ))+ ? pickerOptions.filter(o => `${o.label} ${o.sub} ${o.value} ${o.platforms.join(' ')}`.toLowerCase().includes(modelQ)): pickerOptionsfunction pickModel(v: string) {@@ -368,7 +376,9 @@ export default function PlaygroundPage() {<Check className={`size-4 shrink-0 ${o.value === selectedModel ? 'opacity-100' : 'opacity-0'}`} /><span className="min-w-0 flex-1 truncate">{o.label}</span>{o.isNew && <span className="rounded px-1 py-0.5 text-[9px] font-semibold uppercase leading-none tracking-wide bg-emerald-500/15 text-emerald-600 dark:text-emerald-400">{t('models.newBadge')}</span>}- {o.sub && <span className="shrink-0 text-xs text-muted-foreground">{o.sub}</span>}+ {o.sub && (o.platforms.length > 1+ ? <Tooltip text={t('models.servedBy', { providers: o.platforms.join(', ') })}><span className="shrink-0 text-xs text-muted-foreground underline decoration-dotted underline-offset-2">{o.sub}</span></Tooltip>+ : <span className="shrink-0 text-xs text-muted-foreground">{o.sub}</span>)}</button>)))}diff --git a/server/src/__tests__/routes/proxy-auto-model.test.ts b/server/src/__tests__/routes/proxy-auto-model.test.tsindex cd43049c..4f304962 100644--- a/server/src/__tests__/routes/proxy-auto-model.test.ts+++ b/server/src/__tests__/routes/proxy-auto-model.test.ts@@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, beforeEach, afterEach, vi } from 'viteimport type { Express } from 'express';import { createApp } from '../../app.js';import { initDb, getDb, getUnifiedApiKey } from '../../db/index.js';-import { setUnifyEnabled } from '../../services/model-groups.js';import { mintDashboardToken, isGatedApiPath } from '../helpers/auth.js';let dashToken = '';@@ -43,11 +42,10 @@ describe('Virtual "auto" model', () => {beforeEach(async () => {const db = getDb();- // This suite asserts the legacy per-provider /v1/models catalog semantics- // (#242/#282 — one entry per model_id, owned_by = provider). Model- // unification (default ON) collapses those into logical-model groups, which- // is covered separately in proxy-model-groups.test.ts; pin it OFF here.- setUnifyEnabled(false);+ // Unification is always on: /v1/models lists one entry per logical model+ // (owned_by = freellmapi, id = canonical slug) that aggregates availability+ // across its providers. This suite asserts the availability tagging (#242)+ // and context-window advertising (#282) under that unified shape.db.prepare('DELETE FROM api_keys').run();db.prepare('DELETE FROM requests').run();@@ -106,10 +104,12 @@ describe('Virtual "auto" model', () => {if (m.available) expect(m.unavailable_reason).toBeNull();else expect(['no_key', 'disabled']).toContain(m.unavailable_reason);}- // Only a groq key is seeded: a groq model is available; a non-groq model is- // listed but unavailable for lack of a key.- expect(models.some((m: any) => m.owned_by === 'groq' && m.available)).toBe(true);- expect(models.some((m: any) => m.owned_by !== 'groq' && !m.available && m.unavailable_reason === 'no_key')).toBe(true);+ // Every logical model is owned_by freellmapi (unified). Only a groq key is+ // seeded, so at least one model is available (served by groq) and at least+ // one model with no provider key is listed but unavailable.+ expect(models.every((m: any) => m.owned_by === 'freellmapi')).toBe(true);+ expect(models.some((m: any) => m.available)).toBe(true);+ expect(models.some((m: any) => !m.available && m.unavailable_reason === 'no_key')).toBe(true);});it('?available=true narrows to only connected models (#242)', async () => {@@ -125,19 +125,20 @@ describe('Virtual "auto" model', () => {expect(allModels.length).toBeGreaterThan(filteredModels.length);});- it('marks a disabled model with unavailable_reason "disabled" (#242)', async () => {+ it('marks a fully-disabled model with unavailable_reason "disabled" (#242)', async () => {const db = getDb();- const row = db.prepare("SELECT model_id FROM models WHERE platform='groq' AND enabled=1 LIMIT 1").get() as { model_id: string } | undefined;+ const row = db.prepare("SELECT display_name FROM models WHERE platform='groq' AND enabled=1 LIMIT 1").get() as { display_name: string } | undefined;expect(row).toBeDefined();- db.prepare('UPDATE models SET enabled=0 WHERE model_id=?').run(row!.model_id);+ // A unified model stays available while ANY of its providers is enabled, so+ // disable every provider that serves this logical model (same display_name).+ db.prepare('UPDATE models SET enabled=0 WHERE display_name=?').run(row!.display_name);try {const { body } = await request(app, 'GET', '/v1/models', undefined, authHeaders());- const entry = body.data.find((m: any) => m.id === row!.model_id);- expect(entry).toBeDefined();- expect(entry.available).toBe(false);- expect(entry.unavailable_reason).toBe('disabled');+ const disabled = body.data.filter((m: any) => m.id !== 'auto' && m.unavailable_reason === 'disabled');+ expect(disabled.length).toBeGreaterThan(0);+ expect(disabled.every((m: any) => m.available === false)).toBe(true);} finally {- db.prepare('UPDATE models SET enabled=1 WHERE model_id=?').run(row!.model_id);+ db.prepare('UPDATE models SET enabled=1 WHERE display_name=?').run(row!.display_name);}});diff --git a/server/src/__tests__/routes/proxy-model-groups.test.ts b/server/src/__tests__/routes/proxy-model-groups.test.tsindex bc4aba9f..49984951 100644--- a/server/src/__tests__/routes/proxy-model-groups.test.ts+++ b/server/src/__tests__/routes/proxy-model-groups.test.ts@@ -210,14 +210,17 @@ describe('Model unification (group the same model across providers)', () => {expect(body.choices).toBeUndefined(); // no answer from any model});- it('with unify OFF, /v1/models lists each provider separately again', async () => {+ it('unification is always on: the toggle was removed, so /v1/models stays collapsed even after setUnifyEnabled(false)', async () => {+ // The unify on/off switch was removed from the product; isUnifyEnabled() now+ // always returns true, so writing the old setting has no effect.setUnifyEnabled(false);const { status, body } = await request(app, 'GET', '/v1/models', undefined, authHeaders());expect(status).toBe(200);- const groq = body.data.find((m: any) => m.id === 'tum-groq');- const cerebras = body.data.find((m: any) => m.id === 'tum-cerebras');- expect(groq?.owned_by).toBe('groq');- expect(cerebras?.owned_by).toBe('cerebras');- expect(body.data.some((m: any) => m.id === 'test-unify-model')).toBe(false);+ const ours = body.data.filter((m: any) => m.name === 'Test Unify Model');+ expect(ours).toHaveLength(1);+ expect(ours[0].id).toBe('test-unify-model');+ expect(ours[0].owned_by).toBe('freellmapi');+ // The raw per-provider ids are never advertised anymore.+ expect(body.data.some((m: any) => m.id === 'tum-groq' || m.id === 'tum-cerebras')).toBe(false);});});diff --git a/server/src/services/model-groups.ts b/server/src/services/model-groups.tsindex 8f5a037f..81286e30 100644--- a/server/src/services/model-groups.ts+++ b/server/src/services/model-groups.ts@@ -58,10 +58,13 @@ export interface ModelGroup {}// ── Settings accessors ───────────────────────────────────────────────────────+// Unification is now always on: a model served by several providers is always+// shown as one logical model that fails over across its providers. The on/off+// toggle was removed from the UI, so a user who previously turned it off is+// still unified. (setUnifyEnabled + the stored setting remain only so the+// settings endpoint stays backward-compatible; the value is ignored here.)export function isUnifyEnabled(): boolean {- const raw = getSetting(UNIFY_ENABLED_KEY);- if (raw == null) return true; // default ON- return raw === '1' || raw.toLowerCase() === 'true';+ return true;}export function setUnifyEnabled(on: boolean): void {